This way we can simplify the view, particularly the form. However, we're still adding some complexity to the form so inputs are inside labels and so the collection is easier to style with CSS.
28 lines
585 B
Ruby
28 lines
585 B
Ruby
class Admin::LocalesController < Admin::BaseController
|
|
before_action :set_locales_settings
|
|
authorize_resource :locales_settings
|
|
|
|
def show
|
|
end
|
|
|
|
def update
|
|
@locales_settings.update!(locales_settings_params)
|
|
|
|
redirect_to admin_locales_path, notice: t("admin.locales.update.notice")
|
|
end
|
|
|
|
private
|
|
|
|
def locales_settings_params
|
|
params.require(:setting_locales_settings).permit(allowed_params)
|
|
end
|
|
|
|
def allowed_params
|
|
[:default, enabled: []]
|
|
end
|
|
|
|
def set_locales_settings
|
|
@locales_settings = Setting::LocalesSettings.new
|
|
end
|
|
end
|