Add ng words for post/update
This commit is contained in:
parent
d4602118fb
commit
c553275381
12 changed files with 110 additions and 2 deletions
34
app/controllers/admin/ng_words_controller.rb
Normal file
34
app/controllers/admin/ng_words_controller.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class NgWordsController < BaseController
|
||||
def show
|
||||
authorize :ng_words, :show?
|
||||
|
||||
@admin_settings = Form::AdminSettings.new
|
||||
end
|
||||
|
||||
def create
|
||||
authorize :ng_words, :create?
|
||||
|
||||
@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 :index
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_update_redirect_path
|
||||
admin_ng_words_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