Class: Decidim::Meetings::Admin::MeetingClosesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Proposals::Admin::Picker
Defined in:
decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb

Overview

This controller allows an admin to manage meetings from a Participatory Process

Instance Method Summary collapse

Methods included from Proposals::Admin::Picker

#proposals_picker

Methods inherited from ApplicationController

#maps_enabled?, #meetings

Instance Method Details

#editObject



12
13
14
15
16
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb', line 12

def edit
  enforce_permission_to :close, :meeting, meeting: meeting

  @form = form(Admin::CloseMeetingForm).from_model(meeting)
end

#updateObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb', line 18

def update
  enforce_permission_to :close, :meeting, meeting: meeting

  @form = form(Admin::CloseMeetingForm).from_params(params.merge(proposals: meeting.sibling_scope(:proposals)))

  CloseMeeting.call(@form, meeting) do
    on(:ok) do
      flash[:notice] = I18n.t("meetings.close.success", scope: "decidim.meetings.admin")
      redirect_to meetings_path
    end

    on(:invalid) do
      flash.now[:alert] = I18n.t("meetings.close.invalid", scope: "decidim.meetings.admin")
      render action: "edit"
    end
  end
end