Class: Decidim::Meetings::Admin::MeetingsController
Overview
This controller allows an admin to manage meetings from a Participatory Process
Instance Method Summary
collapse
#meeting, #meetings
#current_feature, #current_participatory_space, #parent_path
#current_ability_klass, #user_not_authorized_path
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb', line 12
def create
@form = form(MeetingForm).from_params(params, current_feature: current_feature)
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"
end
end
end
|
#destroy ⇒ Object
48
49
50
51
52
53
54
|
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb', line 48
def destroy
meeting.destroy!
flash[:notice] = I18n.t("meetings.destroy.success", scope: "decidim.meetings.admin")
redirect_to meetings_path
end
|
#edit ⇒ Object
28
29
30
|
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb', line 28
def edit
@form = form(MeetingForm).from_model(meeting)
end
|
#new ⇒ Object
8
9
10
|
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb', line 8
def new
@form = form(MeetingForm).instance
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'decidim-meetings/app/controllers/decidim/meetings/admin/meetings_controller.rb', line 32
def update
@form = form(MeetingForm).from_params(params, current_feature: current_feature)
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"
end
end
end
|