Class: Decidim::TermCustomizer::Admin::TranslationSetsController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::TermCustomizer::Admin::TranslationSetsController
- Includes:
- TranslatableAttributes
- Defined in:
- app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 24 def create :create, :translation_set @form = form(TranslationSetForm).from_params( params, current_organization: current_organization ) CreateTranslationSet.call(@form) do on(:ok) do |set| flash[:notice] = I18n.t("translation_sets.create.success", scope: "decidim.term_customizer.admin") redirect_to translation_set_translations_path(set) end on(:invalid) do flash.now[:alert] = I18n.t("translation_sets.create.error", scope: "decidim.term_customizer.admin") render action: "new" end end end |
#destroy ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 69 def destroy :destroy, :translation_set, translation_set: set set.destroy! flash[:notice] = I18n.t("translation_sets.destroy.success", scope: "decidim.term_customizer.admin") redirect_to translation_sets_path end |
#edit ⇒ Object
44 45 46 47 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 44 def edit :update, :translation_set, translation_set: set @form = form(TranslationSetForm).from_model(set) end |
#index ⇒ Object
11 12 13 14 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 11 def index :read, :translation_set @sets = collection end |
#new ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 16 def new :create, :translation_set @form = form(TranslationSetForm).from_model( TranslationSet.new(constraints: [Constraint.new]) ) end |
#update ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/decidim/term_customizer/admin/translation_sets_controller.rb', line 49 def update :update, :translation_set, translation_set: set @form = form(TranslationSetForm).from_params( params, current_organization: current_organization ) UpdateTranslationSet.call(@form, set) do on(:ok) do flash[:notice] = I18n.t("translation_sets.update.success", scope: "decidim.term_customizer.admin") redirect_to translation_sets_path end on(:invalid) do flash.now[:alert] = I18n.t("translation_sets.update.error", scope: "decidim.term_customizer.admin") render action: "edit" end end end |