Class: Decidim::Meetings::Admin::AgendaController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Meetings::Admin::AgendaController
- Defined in:
- 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
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 17 def create :create, :agenda, meeting: meeting @form = form(MeetingAgendaForm).from_params(params, meeting: 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 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 35 def edit :update, :agenda, agenda: agenda, meeting: meeting @form = form(MeetingAgendaForm).from_model(agenda) end |
#new ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 11 def new :create, :agenda, meeting: 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 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 41 def update :update, :agenda, agenda: agenda, meeting: meeting @form = form(MeetingAgendaForm).from_params(params, meeting: 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 |