Class: Admin::TranslationsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Admin::TranslationsController
- Defined in:
- lib/generators/open_loam/install/templates/admin/translations_controller.rb
Overview
Per-record content translations (OpenLoam::Translatable) — manager-only, since translating content is a privileged edit. Scoped by translatable_type + translatable_id; edits each translatable field across OpenLoam.locales. The base (default-locale) value stays on the record itself and is shown read-only for reference — translations are additive.
Constant Summary
Constants included from Pagination
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from Pagination
Instance Method Details
#index ⇒ Object
11 |
# File 'lib/generators/open_loam/install/templates/admin/translations_controller.rb', line 11 def index; end |
#update ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/generators/open_loam/install/templates/admin/translations_controller.rb', line 13 def update params.require(:translations).to_unsafe_h.each do |field, by_locale| next unless @record.class.open_loam_translatable?(field) by_locale.each { |locale, value| @record.set_translation(field, locale, value) if OpenLoam.locales.include?(locale) } end redirect_to translate_path, notice: "Translations saved." end |