about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-09 14:00:55 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-09 14:00:55 +0100
commit75f80bef107cfe9e9c0e6ba3dc51ef86c89e40cc (patch)
treed507368baac4e85d417af4c64ecc0d9c43a65963 /app/controllers
parent23ebf60b95984764992c4b356048786ed0ab2953 (diff)
Persist UI settings, add missing localizations for German
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/web/settings_controller.rb15
-rw-r--r--app/controllers/home_controller.rb1
2 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/api/web/settings_controller.rb b/app/controllers/api/web/settings_controller.rb
new file mode 100644
index 000000000..e6f690114
--- /dev/null
+++ b/app/controllers/api/web/settings_controller.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class Api::Web::SettingsController < ApiController
+  respond_to :json
+
+  before_action :require_user!
+
+  def update
+    setting      = Web::Setting.where(user: current_user).first_or_initialize(user: current_user)
+    setting.data = params[:data]
+    setting.save!
+
+    render_empty
+  end
+end
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index a25fe77da..814b1f758 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -6,6 +6,7 @@ class HomeController < ApplicationController
   def index
     @body_classes = 'app-body'
     @token        = find_or_create_access_token.token
+    @web_settings = Web::Setting.find_by(user: current_user)&.data || {}
   end
 
   private