Mercurial > hg > soundsoftware-site
comparison app/controllers/attachments_controller.rb @ 1026:b42553f6df71 bibplugin_bibtex
Merge
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 13 Nov 2012 13:23:29 +0000 |
parents | 19884e9d5eff |
children | bb32da3bea34 |
comparison
equal
deleted
inserted
replaced
953:b52621512b47 | 1026:b42553f6df71 |
---|---|
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 class AttachmentsController < ApplicationController | 18 class AttachmentsController < ApplicationController |
19 | |
20 include AttachmentsHelper | |
21 helper :attachments | |
19 | 22 |
20 before_filter :find_project | 23 before_filter :find_project |
21 before_filter :file_readable, :read_authorize, :except => :destroy | 24 before_filter :file_readable, :read_authorize, :except => :destroy |
22 before_filter :delete_authorize, :only => :destroy | 25 before_filter :delete_authorize, :only => :destroy |
23 before_filter :active_authorize, :only => :toggle_active | 26 before_filter :active_authorize, :only => :toggle_active |
47 format.api | 50 format.api |
48 end | 51 end |
49 end | 52 end |
50 | 53 |
51 def download | 54 def download |
52 if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project) | 55 # cc: formerly this happened only if "@attachment.container.is_a?(Version)" |
56 # or Project. Not good for us, we want to tally all downloads [by humans] | |
57 if not user_is_search_bot? | |
53 @attachment.increment_download | 58 @attachment.increment_download |
54 end | 59 end |
55 | 60 |
56 # images are sent inline | 61 # images are sent inline |
57 send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), | 62 send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), |