Class: Spina::Admin::Conferences::PresentationTypesController
- Inherits:
-
ApplicationController
- Object
- AdminController
- ApplicationController
- Spina::Admin::Conferences::PresentationTypesController
- Defined in:
- app/controllers/spina/admin/conferences/presentation_types_controller.rb
Overview
Controller for PresentationType objects.
Actions collapse
-
#create ⇒ void
Creates a presentation type.
-
#destroy ⇒ void
Destroys a presentation type.
-
#edit ⇒ void
Renders a form for an existing presentation type.
-
#index ⇒ void
Renders a list of presentation types.
-
#new ⇒ void
Renders a form for a new presentation type.
-
#update ⇒ void
Updates a presentation type.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates a presentation type.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 38 def create # rubocop:disable Metrics/MethodLength @presentation_type = PresentationType.new presentation_type_params if @presentation_type.save redirect_to admin_conferences_presentation_types_path, success: t('.saved') else respond_to do |format| format.html do t('.new') render :new end format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } } end end end |
#destroy ⇒ void
This method returns an undefined value.
Destroys a presentation type.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 72 def destroy # rubocop:disable Metrics/MethodLength if @presentation_type.destroy redirect_to admin_conferences_presentation_types_path, success: t('.destroyed') else respond_to do |format| format.html do @presentation_type.name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } } end end end |
#edit ⇒ void
This method returns an undefined value.
Renders a form for an existing presentation type.
32 33 34 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 32 def edit @presentation_type.name end |
#index ⇒ void
This method returns an undefined value.
Renders a list of presentation types.
19 20 21 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 19 def index @presentation_types = PresentationType.sorted.page(params[:page]) end |
#new ⇒ void
This method returns an undefined value.
Renders a form for a new presentation type.
25 26 27 28 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 25 def new @presentation_type = PresentationType.new t('.new') end |
#update ⇒ void
This method returns an undefined value.
Updates a presentation type.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/spina/admin/conferences/presentation_types_controller.rb', line 56 def update # rubocop:disable Metrics/MethodLength if @presentation_type.update(presentation_type_params) redirect_to admin_conferences_presentation_types_path, success: t('.saved') else respond_to do |format| format.html do @presentation_type.name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @presentation_type.errors } } end end end |