Class: Decidim::Conferences::Admin::MediaLinksController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Conferences::Admin::MediaLinksController
- Includes:
- Concerns::ConferenceAdmin, Paginable
- Defined in:
- app/controllers/decidim/conferences/admin/media_links_controller.rb
Overview
Controller that allows managing conference media links.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 22 def create :create, :media_link @form = form(Decidim::Conferences::Admin::MediaLinkForm).from_params(params) CreateMediaLink.call(@form) do on(:ok) do flash[:notice] = I18n.t("media_links.create.success", scope: "decidim.admin") redirect_to conference_media_links_path(current_conference) end on(:invalid) do flash[:alert] = I18n.t("media_links.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 63 def destroy @media_link = collection.find(params[:id]) :destroy, :media_link, speaker: @media_link DestroyMediaLink.call(@media_link, current_user) do on(:ok) do flash[:notice] = I18n.t("media_links.destroy.success", scope: "decidim.admin") redirect_to conference_media_links_path(current_conference) end end end |
#edit ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 39 def edit @media_link = collection.find(params[:id]) :update, :media_link, speaker: @media_link @form = form(MediaLinkForm).from_model(@media_link) end |
#index ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 11 def index :index, :media_link @media_links = paginate(collection) end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 17 def new :create, :media_link @form = form(Decidim::Conferences::Admin::MediaLinkForm).instance end |
#update ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/decidim/conferences/admin/media_links_controller.rb', line 45 def update @media_link = collection.find(params[:id]) :update, :media_link, speaker: @media_link @form = form(MediaLinkForm).from_params(params) UpdateMediaLink.call(@form, @media_link) do on(:ok) do flash[:notice] = I18n.t("media_links.update.success", scope: "decidim.admin") redirect_to conference_media_links_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("media_links.update.error", scope: "decidim.admin") render :edit end end end |