Class: Spina::Admin::Conferences::DelegatesController
- Inherits:
-
ApplicationController
- Object
- AdminController
- ApplicationController
- Spina::Admin::Conferences::DelegatesController
- Defined in:
- app/controllers/spina/admin/conferences/delegates_controller.rb
Overview
Controller for Delegate objects.
Actions collapse
-
#create ⇒ void
Creates a delegate.
-
#destroy ⇒ void
Destroys a delegate.
-
#edit ⇒ void
Renders a form for an existing delegate.
-
#import ⇒ void
Imports a delegate.
-
#index ⇒ void
Renders a list of delegates.
-
#new ⇒ void
Renders a form for a new delegate.
-
#update ⇒ void
Updates a delegate.
Instance Method Details
#create ⇒ void
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 t('.new') render :new end format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } } end end end |
#destroy ⇒ void
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 @delegate.full_name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } } end end end |
#edit ⇒ void
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 @delegate.full_name end |
#import ⇒ void
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 |
#index ⇒ void
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 |
#new ⇒ void
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 t('.new') end |
#update ⇒ void
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 @delegate.full_name render :edit end format.turbo_stream { render partial: 'errors', locals: { errors: @delegate.errors } } end end end |