Class: Spina::Admin::AttachmentsController
Instance Method Summary
collapse
#current_admin_path
#current_account, #error_explanation!, #image_tag_with_at2x, #link_to_add_fields, #markdown
Instance Method Details
#create ⇒ Object
16
17
18
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 16
def create
@attachment = Attachment.create(attachment_params)
end
|
#destroy ⇒ Object
20
21
22
23
24
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 20
def destroy
@attachment = Attachment.find(params[:id])
@attachment.destroy
redirect_to spina.admin_attachments_url
end
|
#index ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 10
def index
add_breadcrumb I18n.t('spina.website.documents'), spina.admin_attachments_path
@attachments = Attachment.file_attached.sorted
@attachment = Attachment.new
end
|
#insert ⇒ Object
32
33
34
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 32
def insert
@attachment = Attachment.find(params[:attachment_id])
end
|
#insert_collection ⇒ Object
42
43
44
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 42
def insert_collection
@attachments = Attachment.where(id: params[:attachment_ids])
end
|
#select ⇒ Object
26
27
28
29
30
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 26
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
36
37
38
39
40
|
# File 'app/controllers/spina/admin/attachments_controller.rb', line 36
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
|