diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/accounts_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/settings_controller.rb | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index ef2f8c4c2..7bceee2cd 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -22,8 +22,8 @@ module Admin end def redownload - @account.avatar = @account.avatar_remote_url - @account.header = @account.header_remote_url + @account.reset_avatar! + @account.reset_header! @account.save! redirect_to admin_account_path(@account.id) diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index fcd42c79c..5985d6282 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -8,13 +8,21 @@ module Admin site_title site_description site_extended_description + site_terms open_registrations closed_registrations_message + open_deletion + timeline_preview + ).freeze + + BOOLEAN_SETTINGS = %w( + open_registrations + open_deletion + timeline_preview ).freeze - BOOLEAN_SETTINGS = %w(open_registrations).freeze def edit - @settings = Setting.all_as_records + @admin_settings = Form::AdminSettings.new end def update @@ -23,19 +31,19 @@ module Admin setting.update(value: value_for_update(key, value)) end - flash[:notice] = 'Success!' + flash[:notice] = I18n.t('generic.changes_saved_msg') redirect_to edit_admin_settings_path end private def settings_params - params.permit(ADMIN_SETTINGS) + params.require(:form_admin_settings).permit(ADMIN_SETTINGS) end def value_for_update(key, value) if BOOLEAN_SETTINGS.include?(key) - value == 'true' + value == '1' else value end |