Class: Decidim::Meetings::Admin::AgendaController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- Admin::ApplicationController
- Admin::Components::BaseController
- ApplicationController
- Decidim::Meetings::Admin::AgendaController
- Defined in:
- decidim-meetings/app/controllers/decidim/meetings/admin/agenda_controller.rb
Overview
Controller that allows managing the agendas for the given meeting
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods inherited from Admin::Components::BaseController
#current_component, #current_participatory_space, #parent_path, #permission_class_chain, #permission_scope, #permissions_context, #set_component_breadcrumb_item, #skip_manage_component_permission
Methods included from RegistersPermissions
Methods inherited from Admin::ApplicationController
#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path
Methods included from Headers::HttpCachingDisabler
Methods included from NeedsSnippets
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/agenda_controller.rb', line 17 def create (:create, :agenda, meeting:) @form = form(MeetingAgendaForm).from_params(params, meeting:) CreateAgenda.call(@form, meeting) do on(:ok) do flash[:notice] = I18n.t("agenda.create.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("agenda.create.invalid", scope: "decidim.meetings.admin") render action: "new" end end end |
#edit ⇒ Object
35 36 37 38 39 |
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/agenda_controller.rb', line 35 def edit (:update, :agenda, agenda:, meeting:) @form = form(MeetingAgendaForm).from_model(agenda) end |
#new ⇒ Object
11 12 13 14 15 |
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/agenda_controller.rb', line 11 def new (:create, :agenda, meeting:) @form = form(MeetingAgendaForm).instance end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/agenda_controller.rb', line 41 def update (:update, :agenda, agenda:, meeting:) @form = form(MeetingAgendaForm).from_params(params, meeting:) UpdateAgenda.call(@form, agenda) do on(:ok) do flash[:notice] = I18n.t("agenda.update.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("agenda.update.invalid", scope: "decidim.meetings.admin") render action: "edit" end end end |