Feature #44460 » 0002-Display-the-MIME-type-on-the-attachment-preview-page.patch
| app/views/layouts/_file.html.erb | ||
|---|---|---|
| 8 | 8 | |
| 9 | 9 |
<div class="attachments"> |
| 10 | 10 |
<p><% if @attachment.description.present? %><%= @attachment.description %><br /><% end %> |
| 11 |
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p> |
|
| 11 |
<% content_type = content_tag(:span, @attachment.content_type, :class => 'content-type') if @attachment.content_type.present? %> |
|
| 12 |
<span class="author"><%= safe_join([link_to_user(@attachment.author), format_time(@attachment.created_on), content_type].compact, ', ') %></span></p> |
|
| 12 | 13 |
</div> |
| 13 | 14 |
<div class="filecontent-container"> |
| 14 | 15 |
<%= yield %> |
| test/functional/attachments_controller_test.rb | ||
|---|---|---|
| 144 | 144 |
assert_equal 'text/html', @response.media_type |
| 145 | 145 |
end |
| 146 | 146 | |
| 147 |
def test_show_should_display_content_type |
|
| 148 |
get(:show, :params => {:id => 4})
|
|
| 149 |
assert_response :success |
|
| 150 |
assert_select 'div.attachments span.author span.content-type', :text => 'application/x-ruby' |
|
| 151 |
assert_select 'div.attachments span.author', :text => /, application\/x-ruby\z/ |
|
| 152 |
end |
|
| 153 | ||
| 154 |
def test_show_should_not_display_content_type_if_blank |
|
| 155 |
get(:show, :params => {:id => 22})
|
|
| 156 |
assert_response :success |
|
| 157 |
assert_select 'div.attachments span.content-type', 0 |
|
| 158 |
end |
|
| 159 | ||
| 147 | 160 |
def test_show_text_file_utf_8 |
| 148 | 161 |
set_tmp_attachments_directory |
| 149 | 162 |
a = Attachment.new(:container => Issue.find(1), |