From 75f80bef107cfe9e9c0e6ba3dc51ef86c89e40cc Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 9 Jan 2017 14:00:55 +0100 Subject: Persist UI settings, add missing localizations for German --- app/views/home/index.html.haml | 17 +---------------- app/views/home/initial_state.json.rabl | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 app/views/home/initial_state.json.rabl (limited to 'app/views') diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index b4e935041..730249129 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -1,21 +1,6 @@ - content_for :header_tags do :javascript - window.INITIAL_STATE = { - "meta": { - "access_token": "#{@token}", - "locale": "#{I18n.locale}", - "me": #{current_account.id} - }, - - "compose": { - "me": #{current_account.id}, - "private": #{current_account.locked?} - }, - - "accounts": { - #{current_account.id}: #{render(file: 'api/v1/accounts/show', locals: { account: current_user.account }, formats: :json)} - } - }; + window.INITIAL_STATE = #{render(file: 'home/initial_state', formats: :json)} = javascript_include_tag 'application' diff --git a/app/views/home/initial_state.json.rabl b/app/views/home/initial_state.json.rabl new file mode 100644 index 000000000..0e9736f5f --- /dev/null +++ b/app/views/home/initial_state.json.rabl @@ -0,0 +1,24 @@ +object false + +node(:meta) { + { + access_token: @token, + locale: I18n.locale, + me: current_account.id, + } +} + +node(:compose) { + { + me: current_account.id, + private: current_account.locked?, + } +} + +node(:accounts) { + { + current_account.id => partial('api/v1/accounts/show', object: current_account), + } +} + +node(:settings) { @web_settings } -- cgit