Feature #44460 » 0002-Display-the-MIME-type-on-the-attachment-preview-page.patch
| app/views/layouts/_file.html.erb | ||
|---|---|---|
|
<div class="attachments">
|
||
|
<p><% if @attachment.description.present? %><%= @attachment.description %><br /><% end %>
|
||
|
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
|
||
|
<% content_type = content_tag(:span, @attachment.content_type, :class => 'content-type') if @attachment.content_type.present? %>
|
||
|
<span class="author"><%= safe_join([link_to_user(@attachment.author), format_time(@attachment.created_on), content_type].compact, ', ') %></span></p>
|
||
|
</div>
|
||
|
<div class="filecontent-container">
|
||
|
<%= yield %>
|
||
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
|
assert_equal 'text/html', @response.media_type
|
||
|
end
|
||
|
def test_show_should_display_content_type
|
||
|
get(:show, :params => {:id => 4})
|
||
|
assert_response :success
|
||
|
assert_select 'div.attachments span.author span.content-type', :text => 'application/x-ruby'
|
||
|
assert_select 'div.attachments span.author', :text => /, application\/x-ruby\z/
|
||
|
end
|
||
|
def test_show_should_not_display_content_type_if_blank
|
||
|
get(:show, :params => {:id => 22})
|
||
|
assert_response :success
|
||
|
assert_select 'div.attachments span.content-type', 0
|
||
|
end
|
||
|
def test_show_text_file_utf_8
|
||
|
set_tmp_attachments_directory
|
||
|
a = Attachment.new(:container => Issue.find(1),
|
||