Class: Spina::Admin::AttachmentsController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- Spina::ApplicationController
- AdminController
- Spina::Admin::AttachmentsController
- Defined in:
- app/controllers/spina/admin/attachments_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #insert ⇒ Object
- #insert_collection ⇒ Object
- #select ⇒ Object
- #select_collection ⇒ Object
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
14 15 16 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 14 def create @attachment = Attachment.create() end |
#destroy ⇒ Object
18 19 20 21 22 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 18 def destroy @attachment = Attachment.find(params[:id]) @attachment.destroy redirect_to spina. end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 8 def index I18n.t('spina.website.documents'), spina. @attachments = Attachment.file_attached.sorted @attachment = Attachment.new end |
#insert ⇒ Object
30 31 32 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 30 def insert @attachment = Attachment.find(params[:attachment_id]) end |
#insert_collection ⇒ Object
40 41 42 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 40 def insert_collection @attachments = Attachment.where(id: params[:attachment_ids]) end |
#select ⇒ Object
24 25 26 27 28 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 24 def select @selected_attachment_id = Attachment.find_by(id: params[:selected_attachment_id]).try(:id) @attachments = Attachment.order_by_ids(@selected_attachment_id).file_attached.sorted @attachment = Attachment.new end |
#select_collection ⇒ Object
34 35 36 37 38 |
# File 'app/controllers/spina/admin/attachments_controller.rb', line 34 def select_collection @selected_attachment_ids = Attachment.where(id: params[:selected_attachment_ids]).ids @attachments = Attachment.order_by_ids(@selected_attachment_ids).file_attached.sorted @attachment = Attachment.new end |