Class: Decidim::Meetings::Admin::MeetingsController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Meetings::Admin::MeetingsController
- Includes:
- Admin::HasTrashableResources, Filterable
- 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
- #create ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #publish ⇒ Object
- #unpublish ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 19 def create :create, :meeting @form = meeting_form.from_params(params, current_component:) Decidim::Meetings::Admin::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", status: :unprocessable_entity end end end |
#edit ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 37 def edit (:update, :meeting, meeting:) @form = meeting_form.from_model(meeting) end |
#new ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 13 def new :create, :meeting @form = meeting_form.instance end |
#publish ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 61 def publish (:update, :meeting, meeting:) Decidim::Meetings::Admin::PublishMeeting.call(meeting, current_user) do on(:ok) do flash[:notice] = I18n.t("meetings.publish.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("meetings.publish.invalid", scope: "decidim.meetings.admin") render action: "index", status: :unprocessable_entity end end end |
#unpublish ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 77 def unpublish (:update, :meeting, meeting:) Decidim::Meetings::Admin::UnpublishMeeting.call(meeting, current_user) do on(:ok) do flash[:notice] = I18n.t("meetings.unpublish.success", scope: "decidim.meetings.admin") redirect_to meetings_path end on(:invalid) do flash.now[:alert] = I18n.t("meetings.unpublish.invalid", scope: "decidim.meetings.admin") render action: "index", status: :unprocessable_entity end end end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/decidim/meetings/admin/meetings_controller.rb', line 43 def update (:update, :meeting, meeting:) @form = meeting_form.from_params(params, current_component:) Decidim::Meetings::Admin::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", status: :unprocessable_entity end end end |