diff app/controllers/attachments_controller.rb @ 599:251b380117ce feature_227

Introduce a new latest_downloads plugin to manage active and shortcut for attachments. Add a table for attachment active/shortcut data. Move existing active-handler code into the new plugin (but still using the "old" active column in the attachments table). Note the files_controller stuff doesn't actually work here.
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 16 Aug 2011 17:01:19 +0100
parents 350acce374a2
children
line wrap: on
line diff
--- a/app/controllers/attachments_controller.rb	Fri Aug 12 14:52:07 2011 +0100
+++ b/app/controllers/attachments_controller.rb	Tue Aug 16 17:01:19 2011 +0100
@@ -20,7 +20,6 @@
   before_filter :find_project
   before_filter :file_readable, :read_authorize, :except => :destroy
   before_filter :delete_authorize, :only => :destroy
-  before_filter :active_authorize, :only => :toggle_active
 
   verify :method => :post, :only => :destroy
 
@@ -56,12 +55,6 @@
     redirect_to :controller => 'projects', :action => 'show', :id => @project
   end
 
-  def toggle_active
-    @attachment.active = !@attachment.active?
-    @attachment.save!
-    render :layout => false
-  end
-
 private
   def find_project
     @attachment = Attachment.find(params[:id])
@@ -85,10 +78,6 @@
     @attachment.deletable? ? true : deny_access
   end
 
-  def active_authorize
-    true
-  end
-
   def detect_content_type(attachment)
     content_type = attachment.content_type
     if content_type.blank?