Feature #22482 » 0002-Add-view-for-no-preview-repository-files.patch
| app/controllers/repositories_controller.rb | ||
|---|---|---|
| 168 | 168 |
# If the entry is a dir, show the browser |
| 169 | 169 |
(show; return) if @entry.is_dir? |
| 170 | 170 | |
| 171 |
@content = @repository.cat(@path, @rev) |
|
| 172 |
(show_error_not_found; return) unless @content |
|
| 173 |
if !is_raw && Redmine::MimeType.is_type?('image', @path)
|
|
| 174 |
# simply render |
|
| 175 |
elsif is_raw || |
|
| 176 |
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || |
|
| 177 |
! is_entry_text_data?(@content, @path) |
|
| 171 |
if is_raw |
|
| 178 | 172 |
# Force the download |
| 179 | 173 |
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
|
| 180 | 174 |
send_type = Redmine::MimeType.of(@path) |
| 181 | 175 |
send_opt[:type] = send_type.to_s if send_type |
| 182 |
send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) && !is_raw ? 'inline' : 'attachment')
|
|
| 183 |
send_data @content, send_opt
|
|
| 176 |
send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) ? 'inline' : 'attachment')
|
|
| 177 |
send_data @repository.cat(@path, @rev), send_opt
|
|
| 184 | 178 |
else |
| 185 |
# Prevent empty lines when displaying a file with Windows style eol |
|
| 186 |
# TODO: UTF-16 |
|
| 187 |
# Is this needs? AttachmentsController reads file simply. |
|
| 188 |
@content.gsub!("\r\n", "\n")
|
|
| 179 |
if !@entry.size || @entry.size <= Setting.file_max_size_displayed.to_i.kilobyte |
|
| 180 |
content = @repository.cat(@path, @rev) |
|
| 181 |
(show_error_not_found; return) unless content |
|
| 182 | ||
| 183 |
if content.size <= Setting.file_max_size_displayed.to_i.kilobyte && |
|
| 184 |
is_entry_text_data?(content, @path) |
|
| 185 |
# TODO: UTF-16 |
|
| 186 |
# Prevent empty lines when displaying a file with Windows style eol |
|
| 187 |
# Is this needed? AttachmentsController simply reads file. |
|
| 188 |
@content = content.gsub("\r\n", "\n")
|
|
| 189 |
end |
|
| 190 |
end |
|
| 189 | 191 |
@changeset = @repository.find_changeset_by_name(@rev) |
| 190 | 192 |
end |
| 191 | 193 |
end |
| app/views/common/_other.html.erb | ||
|---|---|---|
| 1 |
<p class="nodata"><%= l(:label_no_preview) %></p> |
|
| app/views/repositories/entry.html.erb | ||
|---|---|---|
| 10 | 10 | |
| 11 | 11 |
<% if Redmine::MimeType.is_type?('image', @path) %>
|
| 12 | 12 |
<%= render :partial => 'common/image', :locals => {:path => url_for(params.merge(:action => 'raw')), :alt => @path} %>
|
| 13 |
<% else %>
|
|
| 13 |
<% elsif @content %>
|
|
| 14 | 14 |
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
|
| 15 |
<% else %> |
|
| 16 |
<%= render :partial => 'common/other' %> |
|
| 15 | 17 |
<% end %> |
| 16 | 18 | |
| 17 | 19 |
<% content_for :header_tags do %> |
| config/locales/de.yml | ||
|---|---|---|
| 655 | 655 |
label_next: Weiter |
| 656 | 656 |
label_no_change_option: (Keine Änderung) |
| 657 | 657 |
label_no_data: Nichts anzuzeigen |
| 658 |
label_no_preview: Keine Vorschau verfügbar |
|
| 658 | 659 |
label_no_issues_in_project: keine Tickets im Projekt |
| 659 | 660 |
label_nobody: Niemand |
| 660 | 661 |
label_none: kein |
| config/locales/en-GB.yml | ||
|---|---|---|
| 531 | 531 |
label_attribute: Attribute |
| 532 | 532 |
label_attribute_plural: Attributes |
| 533 | 533 |
label_no_data: No data to display |
| 534 |
label_no_preview: No preview available |
|
| 534 | 535 |
label_change_status: Change status |
| 535 | 536 |
label_history: History |
| 536 | 537 |
label_attachment: File |
| config/locales/en.yml | ||
|---|---|---|
| 617 | 617 |
label_attribute: Attribute |
| 618 | 618 |
label_attribute_plural: Attributes |
| 619 | 619 |
label_no_data: No data to display |
| 620 |
label_no_preview: No preview available |
|
| 620 | 621 |
label_change_status: Change status |
| 621 | 622 |
label_history: History |
| 622 | 623 |
label_attachment: File |
- « Previous
- 1
- 2
- 3
- 4
- Next »