Class: Decidim::Conferences::Admin::RegistrationTypesController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::Conferences::Admin::RegistrationTypesController
- Includes:
- ApplicationHelper, Concerns::ConferenceAdmin, Paginable
- Defined in:
- app/controllers/decidim/conferences/admin/registration_types_controller.rb
Overview
Controller that allows managing conference speakers.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 26 def create :create, :registration_type @form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_params(params) CreateRegistrationType.call(@form) do on(:ok) do flash[:notice] = I18n.t("registration_types.create.success", scope: "decidim.admin") redirect_to conference_registration_types_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("registration_types.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 67 def destroy @registration_type = collection.find(params[:id]) :destroy, :registration_type, registration_type: @registration_type DestroyRegistrationType.call(@registration_type, current_user) do on(:ok) do flash[:notice] = I18n.t("registration_types.destroy.success", scope: "decidim.admin") redirect_to conference_registration_types_path(current_conference) end end end |
#edit ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 43 def edit @registration_type = collection.find(params[:id]) :update, :registration_type, registration_type: @registration_type @form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_model(@registration_type) end |
#index ⇒ Object
15 16 17 18 19 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 15 def index :index, :registration_type @registration_types = paginate(collection) end |
#new ⇒ Object
21 22 23 24 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 21 def new :create, :registration_type @form = form(Decidim::Conferences::Admin::RegistrationTypeForm).instance end |
#update ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/decidim/conferences/admin/registration_types_controller.rb', line 49 def update @registration_type = collection.find(params[:id]) :update, :registration_type, registration_type: @registration_type @form = form(Decidim::Conferences::Admin::RegistrationTypeForm).from_params(params) UpdateRegistrationType.call(@form, @registration_type) do on(:ok) do flash[:notice] = I18n.t("registration_types.update.success", scope: "decidim.admin") redirect_to conference_registration_types_path(current_conference) end on(:invalid) do flash.now[:alert] = I18n.t("registration_types.update.error", scope: "decidim.admin") render :edit end end end |