Class: Decidim::Meetings::Admin::MeetingsController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Meetings::Admin::MeetingsController
- Defined in:
- app/controllers/decidim/meetings/admin/meetings_controller.rb
Overview
This controller allows an admin to manage meetings from a Participatory Process
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 16 def create :create, :meeting @form = form(MeetingForm).from_params(params, current_component: current_component) CreateMeeting.call(@form) do on(:ok) do flash[:notice] = I18n.t("meetings.create.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("meetings.create.invalid", scope: "decidim.meetings.admin") render action: "new" end end end |
#destroy ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 58 def destroy :destroy, :meeting, meeting: meeting DestroyMeeting.call(meeting, current_user) do on(:ok) do flash[:notice] = I18n.t("meetings.destroy.success", scope: "decidim.meetings.admin") redirect_to meetings_path end end end |
#edit ⇒ Object
34 35 36 37 38 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 34 def edit :update, :meeting, meeting: meeting @form = form(MeetingForm).from_model(meeting) end |
#new ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 10 def new :create, :meeting @form = form(MeetingForm).instance end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 40 def update :update, :meeting, meeting: meeting @form = form(MeetingForm).from_params(params, current_component: current_component) UpdateMeeting.call(@form, meeting) do on(:ok) do flash[:notice] = I18n.t("meetings.update.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("meetings.update.invalid", scope: "decidim.meetings.admin") render action: "edit" end end end |