Class: Spina::Admin::Conferences::PresentationsController
- Inherits:
-
ApplicationController
- Object
- AdminController
- ApplicationController
- Spina::Admin::Conferences::PresentationsController
- Defined in:
- app/controllers/spina/admin/conferences/presentations_controller.rb
Overview
Controller for Presentation objects.
Actions collapse
-
#create ⇒ void
Creates a presentation.
-
#destroy ⇒ void
Destroys a presentation.
-
#edit ⇒ void
Renders a form for an existing presentation.
-
#import ⇒ void
Imports a presentation.
-
#index ⇒ void
Renders a list of presentations.
-
#new ⇒ void
Renders a form for a new presentation.
-
#update ⇒ void
Updates a presentation.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates a presentation.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 37 def create # rubocop:disable Metrics/MethodLength @presentation = Presentation.new presentation_params if @presentation.save redirect_to admin_conferences_presentations_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.errors } } end end end |
#destroy ⇒ void
This method returns an undefined value.
Destroys a presentation.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 71 def destroy # rubocop:disable Metrics/MethodLength if @presentation.destroy redirect_to admin_conferences_presentations_path, success: t('.destroyed') else respond_to do |format| format.html do @presentation.title render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } } end end end |
#edit ⇒ void
This method returns an undefined value.
Renders a form for an existing presentation.
31 32 33 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 31 def edit @presentation.title end |
#import ⇒ void
This method returns an undefined value.
Imports a presentation.
88 89 90 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 88 def import Presentation.import params[:file] end |
#index ⇒ void
This method returns an undefined value.
Renders a list of presentations.
18 19 20 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 18 def index @presentations = Presentation.sorted.page(params[:page]) end |
#new ⇒ void
This method returns an undefined value.
Renders a form for a new presentation.
24 25 26 27 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 24 def new @presentation = Presentation.new t('.new') end |
#update ⇒ void
This method returns an undefined value.
Updates a presentation.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/spina/admin/conferences/presentations_controller.rb', line 55 def update # rubocop:disable Metrics/MethodLength if @presentation.update(presentation_params) redirect_to admin_conferences_presentations_path, success: t('.saved') else respond_to do |format| format.html do @presentation.title render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } } end end end |