mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 17:26:06 +01:00
Show attachment view even is no preview is available (#22482).
Patch by Gregor Schmidt. git-svn-id: http://svn.redmine.org/redmine/trunk@15398 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -43,7 +43,7 @@ class AttachmentsController < ApplicationController
|
|||||||
elsif @attachment.is_image?
|
elsif @attachment.is_image?
|
||||||
render :action => 'image'
|
render :action => 'image'
|
||||||
else
|
else
|
||||||
download
|
render :action => 'other'
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
format.api
|
format.api
|
||||||
|
|||||||
3
app/views/attachments/other.html.erb
Normal file
3
app/views/attachments/other.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<%= render :layout => 'layouts/file' do %>
|
||||||
|
<%= render :partial => 'common/other' %>
|
||||||
|
<% end %>
|
||||||
@@ -179,12 +179,13 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_text_file_should_send_if_too_big
|
def test_show_text_file_should_show_other_if_too_big
|
||||||
with_settings :file_max_size_displayed => 512 do
|
with_settings :file_max_size_displayed => 512 do
|
||||||
Attachment.find(4).update_attribute :filesize, 754.kilobyte
|
Attachment.find(4).update_attribute :filesize, 754.kilobyte
|
||||||
get :show, :id => 4
|
get :show, :id => 4
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 'application/x-ruby', @response.content_type
|
assert_template 'other'
|
||||||
|
assert_equal 'text/html', @response.content_type
|
||||||
end
|
end
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
end
|
end
|
||||||
@@ -200,8 +201,9 @@ class AttachmentsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
def test_show_other
|
def test_show_other
|
||||||
get :show, :id => 6
|
get :show, :id => 6
|
||||||
assert_response :success
|
assert_template 'other'
|
||||||
assert_equal 'application/zip', @response.content_type
|
assert_equal 'text/html', @response.content_type
|
||||||
|
assert_select '.nodata', :text => 'No preview available'
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user