Class: Decidim::Conferences::Admin::DiplomasController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Conferences::Admin::DiplomasController
- Includes:
- Concerns::ConferenceAdmin
- Defined in:
- app/controllers/decidim/conferences/admin/diplomas_controller.rb
Overview
This controller allows an admin to manage Conference Diploma configuration
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/decidim/conferences/admin/diplomas_controller.rb', line 12 def edit :update, :conference, conference: current_conference @form = form(DiplomaForm).from_model(current_conference) end |
#send_diplomas ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/decidim/conferences/admin/diplomas_controller.rb', line 36 def send_diplomas :send_diplomas, :conference, conference: current_conference SendConferenceDiplomas.call(current_conference, current_user) do on(:ok) do flash[:notice] = I18n.t("send_diploma.success", scope: "decidim.conferences.admin") redirect_to edit_conference_diploma_path(current_conference) end on(:invalid) do flash[:alert] = I18n.t("send_diploma.error", scope: "decidim.conferences.admin") redirect_to edit_conference_diploma_path(current_conference) end end end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/decidim/conferences/admin/diplomas_controller.rb', line 18 def update :update, :conference, conference: current_conference @form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference, current_organization:) UpdateDiploma.call(@form, current_conference) do on(:ok) do flash[:notice] = I18n.t("conferences.update.success", scope: "decidim.admin") redirect_to edit_conference_diploma_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("conferences.update.error", scope: "decidim.admin") render :edit end end end |