Class: Spina::Admin::Conferences::ConferencesController
- Inherits:
-
ApplicationController
- Object
- AdminController
- ApplicationController
- Spina::Admin::Conferences::ConferencesController
- Defined in:
- app/controllers/spina/admin/conferences/conferences_controller.rb
Overview
Controller for Conference objects.
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
-
#create ⇒ void
Creates a conference.
-
#destroy ⇒ void
Destroys a conference.
-
#edit ⇒ void
Renders a form for an existing conference.
-
#index ⇒ void
Renders a list of conferences.
-
#new ⇒ void
Renders a form for a new conference.
-
#update ⇒ void
Updates a conference.
Instance Method Details
#create ⇒ void
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 t('.new') render :new end format.js { render partial: 'errors', locals: { errors: @conference.errors } } end end end |
#destroy ⇒ void
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 @conference.name render :edit end format.js { render partial: 'errors', locals: { errors: @conference.errors } } end end end |
#edit ⇒ void
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 @conference.name end |
#index ⇒ void
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 |
#new ⇒ void
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 t('.new') end |
#update ⇒ void
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 @conference.name render :edit end format.js { render partial: 'errors', locals: { errors: @conference.errors } } end end end |