Class: Spina::Admin::Conferences::RoomsController

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

Overview

Controller for Room objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates a room.



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

def create # rubocop:disable Metrics/MethodLength
  @room = Room.new(room_params)

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

#destroyvoid

This method returns an undefined value.

Destroys a room.



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

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

#editvoid

This method returns an undefined value.

Renders a form for an existing room.



32
33
34
# File 'app/controllers/spina/admin/conferences/rooms_controller.rb', line 32

def edit
  add_breadcrumb @room.name
end

#indexvoid

This method returns an undefined value.

Renders a list of rooms.



19
20
21
# File 'app/controllers/spina/admin/conferences/rooms_controller.rb', line 19

def index
  @rooms = Room.sorted.page(params[:page])
end

#newvoid

This method returns an undefined value.

Renders a form for a new room.



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

def new
  @room = Room.new
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates a room.



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

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