Class: Admin::PageAttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PageAttachmentsController
- Defined in:
- app/controllers/admin/page_attachments_controller.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #edit ⇒ Object
- #grid ⇒ Object
- #index ⇒ Object
- #move_higher ⇒ Object
- #move_lower ⇒ Object
- #update ⇒ Object
Instance Method Details
#destroy ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 38 def destroy if request.post? @attachment = PageAttachment.find(params[:id]) page = @attachment.page @attachment.destroy render :partial => 'admin/page/attachment', :layout => false, :collection => page. end end |
#edit ⇒ Object
10 11 12 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 10 def edit @page_attachment = PageAttachment.find(params[:id]) end |
#grid ⇒ Object
6 7 8 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 6 def grid @attachments = PageAttachment.paginate :per_page => 25, :page => params[:page], :conditions => {:parent_id => nil}, :order => 'title, filename' end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 3 def index @attachments = PageAttachment.paginate :per_page => 25, :page => params[:page], :conditions => {:parent_id => nil}, :order => 'title, filename' end |
#move_higher ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 22 def move_higher if request.post? @attachment = PageAttachment.find(params[:id]) @attachment.move_higher render :partial => 'admin/page/attachment', :layout => false, :collection => @attachment.page. end end |
#move_lower ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 30 def move_lower if request.post? @attachment = PageAttachment.find(params[:id]) @attachment.move_lower render :partial => 'admin/page/attachment', :layout => false, :collection => @attachment.page. end end |
#update ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 13 def update @page_attachment = PageAttachment.find(params[:id]) if @page_attachment.update_attributes(params[:page_attachment]) redirect_to else render :edit end end |