Commit dd2870128afd53b714e1275ffd25e835c35ef118
Exists in
master
and in
28 other branches
Merge branch 'AI3131' of https://gitlab.com/arthurmde/noosfero into AI3131
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
app/presenters/image.rb
@@ -11,4 +11,8 @@ class FilePresenter::Image < FilePresenter | @@ -11,4 +11,8 @@ class FilePresenter::Image < FilePresenter | ||
11 | def short_description | 11 | def short_description |
12 | _('Image (%s)') % content_type.split('/')[1].upcase | 12 | _('Image (%s)') % content_type.split('/')[1].upcase |
13 | end | 13 | end |
14 | + | ||
15 | + def download? view = nil | ||
16 | + view.blank? || view == 'false' | ||
17 | + end | ||
14 | end | 18 | end |
test/functional/content_viewer_controller_test.rb
@@ -75,6 +75,18 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -75,6 +75,18 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
75 | assert_match /#{html.public_filename}/, @response.body | 75 | assert_match /#{html.public_filename}/, @response.body |
76 | end | 76 | end |
77 | 77 | ||
78 | + should 'produce a download-link when article is a image' do | ||
79 | + profile = create_user('someone').person | ||
80 | + image = UploadedFile.create! :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => profile | ||
81 | + image.save! | ||
82 | + | ||
83 | + get :view_page, :profile => 'someone', :page => [ 'rails.png' ] | ||
84 | + | ||
85 | + assert_response :success | ||
86 | + assert_not_nil assigns(:page).data | ||
87 | + assert_match /image/, @response.headers['Content-Type'] | ||
88 | + end | ||
89 | + | ||
78 | should 'produce a download-link when article is not text/html' do | 90 | should 'produce a download-link when article is not text/html' do |
79 | 91 | ||
80 | # for example, RSS feeds | 92 | # for example, RSS feeds |