about summary refs log tree commit diff
path: root/app/controllers/admin/settings_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/settings_controller.rb')
-rw-r--r--app/controllers/admin/settings_controller.rb46
1 files changed, 22 insertions, 24 deletions
diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb
index 7615c781d..6cca5c3e3 100644
--- a/app/controllers/admin/settings_controller.rb
+++ b/app/controllers/admin/settings_controller.rb
@@ -1,35 +1,33 @@
 # frozen_string_literal: true
 
-class Admin::SettingsController < ApplicationController
-  before_action :require_admin!
-
-  layout 'admin'
+module Admin
+  class SettingsController < BaseController
+    def index
+      @settings = Setting.all_as_records
+    end
 
-  def index
-    @settings = Setting.all_as_records
-  end
+    def update
+      @setting = Setting.where(var: params[:id]).first_or_initialize(var: params[:id])
+      value    = settings_params[:value]
 
-  def update
-    @setting = Setting.where(var: params[:id]).first_or_initialize(var: params[:id])
-    value    = settings_params[:value]
+      # Special cases
+      value = value == 'true' if @setting.var == 'open_registrations'
 
-    # Special cases
-    value = value == 'true' if @setting.var == 'open_registrations'
+      if @setting.value != value
+        @setting.value = value
+        @setting.save
+      end
 
-    if @setting.value != value
-      @setting.value = value
-      @setting.save
+      respond_to do |format|
+        format.html { redirect_to admin_settings_path }
+        format.json { respond_with_bip(@setting) }
+      end
     end
 
-    respond_to do |format|
-      format.html { redirect_to admin_settings_path }
-      format.json { respond_with_bip(@setting) }
-    end
-  end
-
-  private
+    private
 
-  def settings_params
-    params.require(:setting).permit(:value)
+    def settings_params
+      params.require(:setting).permit(:value)
+    end
   end
 end