Class: Admin::AttachmentsController

Inherits:
ResourceController
  • Object
show all
Includes:
UploadHandler
Defined in:
app/controllers/admin/attachments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



5
6
7
8
9
10
11
# File 'app/controllers/admin/attachments_controller.rb', line 5

def create
  rendering_upload_response do
    @page = Page.find(params[:page_id])
    attachment = @page.attachments.create!(params[:attachment])
    render_to_string(:partial => 'admin/assets/attachment', :locals => {:attachment => attachment})
  end
end

#indexObject

Gets called after successful update only used when attachment update form not submitted using javascript



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

def index
  redirect_to edit_admin_page_path(params[:page_id])
end

#positionsObject



19
20
21
# File 'app/controllers/admin/attachments_controller.rb', line 19

def positions
  render :json => Attachment.reorder(params[:attachment])
end