Class: Spina::Admin::Conferences::PresentationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spina/admin/conferences/presentations_controller.rb

Overview

Controller for Presentation objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

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
        add_breadcrumb t('.new')
        render :new
      end
      format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
    end
  end
end

#destroyvoid

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
        add_breadcrumb @presentation.title
        render :edit
      end
      format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
    end
  end
end

#editvoid

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
  add_breadcrumb @presentation.title
end

#importvoid

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

#indexvoid

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

#newvoid

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
  add_breadcrumb t('.new')
end

#updatevoid

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
        add_breadcrumb @presentation.title
        render :edit
      end
      format.turbo_stream { render partial: 'errors', locals: { errors: @presentation.errors } }
    end
  end
end