Class: Spina::Admin::AttachmentsController

Inherits:
AdminController show all
Defined in:
app/controllers/spina/admin/attachments_controller.rb

Instance Method Summary collapse

Methods included from Spina::ApplicationHelper

#captcha, #current_account, #error_explanation!, #image_tag_with_at2x, #link_to_add_fields, #markdown

Instance Method Details

#createObject



16
17
18
# File 'app/controllers/spina/admin/attachments_controller.rb', line 16

def create
  @attachment = Attachment.create(attachment_params)
end

#destroyObject



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

#indexObject



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

#insertObject



31
32
33
# File 'app/controllers/spina/admin/attachments_controller.rb', line 31

def insert
  @attachment = Attachment.find(params[:attachment_id])
end

#insert_collectionObject



40
41
42
# File 'app/controllers/spina/admin/attachments_controller.rb', line 40

def insert_collection
  @attachments = Attachment.find(params[:attachment_ids])
end

#selectObject



26
27
28
29
# File 'app/controllers/spina/admin/attachments_controller.rb', line 26

def select
  @attachments = Attachment.file_attached.sorted
  @attachment = Attachment.new
end

#select_collectionObject



35
36
37
38
# File 'app/controllers/spina/admin/attachments_controller.rb', line 35

def select_collection
  @attachments = Attachment.file_attached.sorted
  @attachment = Attachment.new
end