Class: Spina::Admin::Conferences::ConferencesController

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

Overview

Controller for Conference objects.

See Also:

Constant Summary collapse

PARTS =
[
  { name: 'text', title: 'Text', partable_type: 'Spina::Text' },
  { name: 'submission_url', title: 'Submission URL', partable_type: 'Spina::Admin::Conferences::UrlPart' },
  { name: 'submission_email_address', title: 'Submission email address',
    partable_type: 'Spina::Admin::Conferences::EmailAddressPart' },
  { name: 'submission_date', title: 'Submission date', partable_type: 'Spina::Admin::Conferences::DatePart' },
  { name: 'submission_text', title: 'Submission text', partable_type: 'Spina::Line' },
  { name: 'gallery', title: 'Gallery', partable_type: 'Spina::ImageCollection' },
  { name: 'sponsors', title: 'Sponsors', partable_type: 'Spina::Structure' }
].freeze

Actions collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Creates a conference.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/controllers/spina/admin/conferences/conferences_controller.rb', line 50

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

  if @conference.save
    redirect_to admin_conferences_conferences_path, success: t('.saved')
  else
    respond_to do |format|
      format.html do
        add_breadcrumb t('.new')
        render :new
      end
      format.js { render partial: 'errors', locals: { errors: @conference.errors } }
    end
  end
end

#destroyvoid

This method returns an undefined value.

Destroys a conference.



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'app/controllers/spina/admin/conferences/conferences_controller.rb', line 84

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

#editvoid

This method returns an undefined value.

Renders a form for an existing conference.



44
45
46
# File 'app/controllers/spina/admin/conferences/conferences_controller.rb', line 44

def edit
  add_breadcrumb @conference.name
end

#indexvoid

This method returns an undefined value.

Renders a list of conferences.



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

def index
  @conferences = Conference.sorted
end

#newvoid

This method returns an undefined value.

Renders a form for a new conference.



36
37
38
39
40
# File 'app/controllers/spina/admin/conferences/conferences_controller.rb', line 36

def new
  @conference = Conference.new
  build_parts
  add_breadcrumb t('.new')
end

#updatevoid

This method returns an undefined value.

Updates a conference.



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

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