Class: Decidim::Conferences::Admin::ConferenceSpeakersController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Conferences::Admin::ConferenceSpeakersController
- Includes:
- Decidim::Conferences::Admin::Concerns::ConferenceAdmin, Paginable
- Defined in:
- app/controllers/decidim/conferences/admin/conference_speakers_controller.rb
Overview
Controller that allows managing conference speakers.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #publish ⇒ Object
- #unpublish ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 27 def create :create, :conference_speaker @form = form(ConferenceSpeakerForm).from_params(params) CreateConferenceSpeaker.call(@form) do on(:ok) do flash[:notice] = I18n.t("conference_speakers.create.success", scope: "decidim.admin") redirect_to conference_speakers_path(current_conference) end on(:invalid) do flash[:alert] = I18n.t("conference_speakers.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 66 def destroy :destroy, :conference_speaker, speaker: conference_speaker DestroyConferenceSpeaker.call(conference_speaker, current_user) do on(:ok) do flash[:notice] = I18n.t("conference_speakers.destroy.success", scope: "decidim.admin") redirect_to conference_speakers_path(current_conference) end end end |
#edit ⇒ Object
44 45 46 47 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 44 def edit :update, :conference_speaker, speaker: conference_speaker @form = form(ConferenceSpeakerForm).from_model(conference_speaker) end |
#index ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 14 def index :index, :conference_speaker @query = params[:q] @conference_speakers = paginate(Decidim::Conferences::Admin::ConferenceSpeakers.for(collection, @query)) end |
#new ⇒ Object
22 23 24 25 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 22 def new :create, :conference_speaker @form = form(ConferenceSpeakerForm).instance end |
#publish ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 77 def publish (:update, :conference_speaker, speaker: conference_speaker) Decidim::Conferences::Admin::PublishConferenceSpeaker.call(conference_speaker, current_user) do on(:ok) do flash[:notice] = I18n.t("conference_speakers.publish.success", scope: "decidim.admin") redirect_to conference_speakers_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("conference_speakers.publish.invalid", scope: "decidim.admin") render action: "index" end end end |
#unpublish ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 93 def unpublish (:update, :conference_speaker, speaker: conference_speaker) Decidim::Conferences::Admin::UnpublishConferenceSpeaker.call(conference_speaker, current_user) do on(:ok) do flash[:notice] = I18n.t("conference_speakers.unpublish.success", scope: "decidim.admin") redirect_to conference_speakers_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("conference_speakers.unpublish.invalid", scope: "decidim.admin") render action: "index" end end end |
#update ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/decidim/conferences/admin/conference_speakers_controller.rb', line 49 def update :update, :conference_speaker, speaker: conference_speaker @form = form(ConferenceSpeakerForm).from_params(params) UpdateConferenceSpeaker.call(@form, conference_speaker) do on(:ok) do flash[:notice] = I18n.t("conference_speakers.update.success", scope: "decidim.admin") redirect_to conference_speakers_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("conference_speakers.update.error", scope: "decidim.admin") render :edit end end end |