Class: Spina::Admin::Conferences::InstitutionsController

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

Overview

Controller for Institution objects.

See Also:

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates an institution.



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

def create # rubocop:disable Metrics/MethodLength
  @institution = Institution.new(conference_params)

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

#destroyvoid

This method returns an undefined value.

Destroys an institution.



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

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

#editvoid

This method returns an undefined value.

Renders a form for an existing institution.



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

def edit
  add_breadcrumb @institution.name
end

#indexvoid

This method returns an undefined value.

Renders a list of institutions.



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

def index
  @institutions = Institution.sorted.page(params[:page])
end

#newvoid

This method returns an undefined value.

Renders a form for a new institution.



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

def new
  @institution = Institution.new
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates an institution.



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

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