Class: Decidim::Meetings::Admin::MeetingCopiesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/meetings/admin/meeting_copies_controller.rb

Overview

Controller that allows managing meetings.

Instance Method Summary collapse

Methods inherited from ApplicationController

#maps_enabled?, #meetings

Instance Method Details

#createObject



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

def create
  enforce_permission_to(:copy, :meeting, meeting:)

  @form = form(MeetingForm).from_params(params, current_component:)

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

    on(:invalid) do
      flash.now[:alert] = I18n.t("meeting_copies.create.error", scope: "decidim.admin")
      render :new
    end
  end
end

#newObject



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

def new
  enforce_permission_to(:copy, :meeting, meeting:)

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