Sha256: b407127a0848fa291dd7e951f7070c8ad6994547e482a1b29ac66fc368add04c

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Admin
      # This controller allows an admin to manage meetings from a Participatory Process
      class MeetingClosesController < Admin::ApplicationController
        helper ResourceHelper
        helper_method :meeting

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

        def update
          @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 meetings_path
            end

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

        private

        def meeting
          @meeting ||= Meeting.where(feature: current_feature).find(params[:id])
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
decidim-meetings-0.4.4 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.4.4 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.4.3 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.4.2 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.4.1 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.4.3 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.4.2 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.4.1 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.4.0 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.4.0 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.3.2 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.3.2 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.3.1 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.3.1 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.3.0 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.3.0 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-meetings-0.2.0 app/controllers/decidim/meetings/admin/meeting_closes_controller.rb
decidim-0.2.0 decidim-meetings/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb