* Add: #363 特定サーバーの投稿にスタンプを付けることを禁止する管理者設定 * Fix test
This commit is contained in:
parent
08f2fcb72b
commit
7b8fedb3cd
10 changed files with 157 additions and 26 deletions
34
app/controllers/admin/special_instances_controller.rb
Normal file
34
app/controllers/admin/special_instances_controller.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class SpecialInstancesController < BaseController
|
||||
def show
|
||||
authorize :instance, :show?
|
||||
|
||||
@admin_settings = Form::AdminSettings.new
|
||||
end
|
||||
|
||||
def create
|
||||
authorize :instance, :destroy?
|
||||
|
||||
@admin_settings = Form::AdminSettings.new(settings_params)
|
||||
|
||||
if @admin_settings.save
|
||||
flash[:notice] = I18n.t('generic.changes_saved_msg')
|
||||
redirect_to after_update_redirect_path
|
||||
else
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_update_redirect_path
|
||||
admin_special_instances_path
|
||||
end
|
||||
|
||||
def settings_params
|
||||
params.require(:form_admin_settings).permit(*Form::AdminSettings::KEYS)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue