Files
nairobi/app/controllers/admin/locales_controller.rb
Javi Martín 0c59c2dfb4 Extract model to handle locales settings
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.
2024-06-05 16:10:56 +02:00

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