Class: Comfy::Admin::Cms::TranslationsController
- Inherits:
-
BaseController
- Object
- BaseController
- Comfy::Admin::Cms::TranslationsController
- Defined in:
- app/controllers/comfy/admin/cms/translations_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #form_fragments ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 21 def create @translation.save! flash[:success] = I18n.t("comfy.admin.cms.translations.created") redirect_to action: :edit, id: @translation rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t("comfy.admin.cms.translations.creation_failure") render action: :new end |
#destroy ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 39 def destroy @translation.destroy flash[:success] = I18n.t("comfy.admin.cms.translations.deleted") redirect_to edit_comfy_admin_cms_site_page_path(@site, @page) end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 17 def edit render end |
#form_fragments ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 45 def form_fragments @translation = @page.translations.find_by(id: params[:id]) || @page.translations.new @translation.layout = @site.layouts.find_by(id: params[:layout_id]) render( partial: "comfy/admin/cms/fragments/form_fragments", locals: { record: @translation, scope: :translation }, layout: false ) end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 13 def new render end |
#update ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/controllers/comfy/admin/cms/translations_controller.rb', line 30 def update @translation.update!(translation_params) flash[:success] = I18n.t("comfy.admin.cms.translations.updated") redirect_to action: :edit, id: @translation rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t("comfy.admin.cms.translations.update_failure") render action: :edit end |