You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
570 B

  1. # frozen_string_literal: true
  2. class Admin::SettingsController < ApplicationController
  3. before_action :require_admin!
  4. layout 'admin'
  5. def index
  6. @settings = Setting.all_as_records
  7. end
  8. def update
  9. @setting = Setting.where(var: params[:id]).first_or_initialize(var: params[:id])
  10. if @setting.value != params[:setting][:value]
  11. @setting.value = params[:setting][:value]
  12. @setting.save
  13. end
  14. respond_to do |format|
  15. format.html { redirect_to admin_settings_path }
  16. format.json { respond_with_bip(@setting) }
  17. end
  18. end
  19. end