Class: Decidim::Assemblies::Admin::AssembliesTypesController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::Assemblies::Admin::AssembliesTypesController
- Defined in:
- decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb
Overview
Controller used to manage the available assemblies types for the current organization. As this substitutes former i18n simple hash we need to keep these i18n keys for migrations and rollbacks. So let i18n-tasks know about: i18n-tasks-use t(‘decidim.assemblies.assembly_types.government’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.commission’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.consultative_advisory’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.executive’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.others’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.participatory’) i18n-tasks-use t(‘decidim.assemblies.assembly_types.working_group’) This comment (and the i18n keys) may be removed in future versions
Instance Method Summary collapse
-
#create ⇒ Object
POST /admin/assemblies_types.
-
#destroy ⇒ Object
DELETE /admin/assemblies_types/:id.
-
#edit ⇒ Object
GET /admin/assemblies_types/:id/edit.
-
#index ⇒ Object
GET /admin/assemblies_types.
-
#new ⇒ Object
GET /admin/assemblies_types/new.
-
#update ⇒ Object
PUT /admin/assemblies_types/:id.
Methods inherited from Decidim::Admin::ApplicationController
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Methods included from Headers::HttpCachingDisabler
Methods included from TranslatableAttributes
Methods included from NeedsSnippets
Methods included from RegistersPermissions
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
POST /admin/assemblies_types
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 34 def create :create, :assembly_type @form = assembly_type_form.from_params(params) CreateAssembliesType.call(@form) do on(:ok) do |_assembly_type| flash[:notice] = I18n.t("assemblies_types.create.success", scope: "decidim.admin") redirect_to assemblies_types_path end on(:invalid) do flash.now[:alert] = I18n.t("assemblies_types.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
DELETE /admin/assemblies_types/:id
80 81 82 83 84 85 86 87 88 89 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 80 def destroy :destroy, :assembly_type, assembly_type: current_assembly_type Decidim::Commands::DestroyResource.call(current_assembly_type, current_user) do on(:ok) do flash[:notice] = I18n.t("assemblies_types.destroy.success", scope: "decidim.admin") redirect_to assemblies_types_path end end end |
#edit ⇒ Object
GET /admin/assemblies_types/:id/edit
52 53 54 55 56 57 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 52 def edit :edit, :assembly_type, assembly_type: current_assembly_type @form = assembly_type_form .from_model(current_assembly_type, assembly_type: current_assembly_type) end |
#index ⇒ Object
GET /admin/assemblies_types
23 24 25 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 23 def index :index, :assembly_type end |
#new ⇒ Object
GET /admin/assemblies_types/new
28 29 30 31 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 28 def new :create, :assembly_type @form = assembly_type_form.instance end |
#update ⇒ Object
PUT /admin/assemblies_types/:id
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'decidim-assemblies/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb', line 60 def update :update, :assembly_type, assembly_type: current_assembly_type @form = assembly_type_form .from_params(params, assembly_type: current_assembly_type) UpdateAssembliesType.call(@form, current_assembly_type) do on(:ok) do flash[:notice] = I18n.t("assemblies_types.update.success", scope: "decidim.admin") redirect_to assemblies_types_path end on(:invalid) do flash.now[:alert] = I18n.t("assemblies_types.update.error", scope: "decidim.admin") render :edit end end end |