Class: Spina::Admin::Conferences::SessionsController

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

Overview

Controller for Session objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates a session.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 39

def create # rubocop:disable Metrics/MethodLength
  @session = Session.new(session_params)

  if @session.save
    redirect_to admin_conferences_sessions_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: @session.errors } }
    end
  end
end

#destroyvoid

This method returns an undefined value.

Destroys a session.



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 73

def destroy # rubocop:disable Metrics/MethodLength
  if @session.destroy
    redirect_to admin_conferences_sessions_path, success: t('.destroyed')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb @session.name
        render :edit
      end
      format.turbo_stream { render partial: 'errors', locals: { errors: @session.errors } }
    end
  end
end

#editvoid

This method returns an undefined value.

Renders a form for an existing session.



33
34
35
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 33

def edit
  add_breadcrumb @session.name
end

#indexvoid

This method returns an undefined value.

Renders a list of sessions.



20
21
22
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 20

def index
  @sessions = Session.all.page(params[:page])
end

#newvoid

This method returns an undefined value.

Renders a form for a new session.



26
27
28
29
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 26

def new
  @session = Session.new
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates a session.



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/controllers/spina/admin/conferences/sessions_controller.rb', line 57

def update # rubocop:disable Metrics/MethodLength
  if @session.update(session_params)
    redirect_to admin_conferences_sessions_path, success: t('.saved')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb @session.name
        render :edit
      end
      format.turbo_stream { render partial: 'errors', locals: { errors: @session.errors } }
    end
  end
end