Class: Decidim::Conferences::Admin::ConferencesController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Conferences::Admin::ConferencesController
- Includes:
- Admin::ParticipatorySpaceAdminBreadcrumb, Filterable
- Defined in:
- app/controllers/decidim/conferences/admin/conferences_controller.rb
Overview
Controller that allows managing conferences.
Instance Method Summary collapse
Instance Method Details
#copy ⇒ Object
68 69 70 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 68 def copy :create, :conference end |
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 25 def create :create, :conference @form = form(ConferenceForm).from_params(params) CreateConference.call(@form) do on(:ok) do flash[:notice] = I18n.t("conferences.create.success", scope: "decidim.admin") redirect_to conferences_path end on(:invalid) do flash.now[:alert] = I18n.t("conferences.create.error", scope: "decidim.admin") render :new end end end |
#edit ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 42 def edit :update, :conference, conference: current_conference @form = form(ConferenceForm).from_model(current_conference) render layout: "decidim/admin/conference" end |
#index ⇒ Object
15 16 17 18 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 15 def index :read, :conference_list @conferences = filtered_collection end |
#new ⇒ Object
20 21 22 23 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 20 def new :create, :conference @form = form(ConferenceForm).instance end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/controllers/decidim/conferences/admin/conferences_controller.rb', line 48 def update :update, :conference, conference: current_conference @form = form(ConferenceForm).from_params( conference_params, conference_id: current_conference.id ) UpdateConference.call(@form, current_conference) do on(:ok) do |conference| flash[:notice] = I18n.t("conferences.update.success", scope: "decidim.admin") redirect_to edit_conference_path(conference) end on(:invalid) do flash.now[:alert] = I18n.t("conferences.update.error", scope: "decidim.admin") render :edit, layout: "decidim/admin/conference" end end end |