Class: Spina::Admin::Conferences::DelegatesController

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

Overview

Controller for Delegate objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates a delegate.



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

def create # rubocop:disable Metrics/MethodLength
  @delegate = Delegate.new(delegate_params)

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

#destroyvoid

This method returns an undefined value.

Destroys a delegate.



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

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

#editvoid

This method returns an undefined value.

Renders a form for an existing delegate.



30
31
32
# File 'app/controllers/spina/admin/conferences/delegates_controller.rb', line 30

def edit
  add_breadcrumb @delegate.full_name
end

#importvoid

This method returns an undefined value.

Imports a delegate.



87
88
89
# File 'app/controllers/spina/admin/conferences/delegates_controller.rb', line 87

def import
  Delegate.import params[:file]
end

#indexvoid

This method returns an undefined value.

Renders a list of delegates.



17
18
19
# File 'app/controllers/spina/admin/conferences/delegates_controller.rb', line 17

def index
  @delegates = Delegate.sorted.page(params[:page])
end

#newvoid

This method returns an undefined value.

Renders a form for a new delegate.



23
24
25
26
# File 'app/controllers/spina/admin/conferences/delegates_controller.rb', line 23

def new
  @delegate = Delegate.new
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates a delegate.



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

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