Class: Decidim::Meetings::MeetingClosesController

Inherits:
ApplicationController show all
Includes:
FormFactory
Defined in:
decidim-meetings/app/controllers/decidim/meetings/meeting_closes_controller.rb

Overview

This controller allows a participant to update the closing_report and the linked proposals of a closed meeting

Instance Method Summary collapse

Methods inherited from Components::BaseController

#current_component, #current_manifest, #current_participatory_space, #permission_class_chain, #permission_scope, #redirect_unless_feature_private, #set_component_breadcrumb_item, #share_token

Methods included from RegistersPermissions

register_permissions

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from Headers::HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#editObject



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

def edit
  enforce_permission_to(:close, :meeting, meeting:)

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

#updateObject



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

def update
  enforce_permission_to(:close, :meeting, meeting:)

  @form = form(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 meeting_path(meeting)
    end

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