diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-17 09:51:19 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-17 09:51:19 +0000 |
commit | 580b591c57a0a70f7cf8a1dd34be85e0fcaa8b05 (patch) | |
tree | 77419f10ff7883b8d81cd186e2f419c46d3af908 | |
parent | 0a9b0dd46c917cacb6b04298c0d1aa3a0055a473 (diff) | |
download | redmine-580b591c57a0a70f7cf8a1dd34be85e0fcaa8b05.tar.gz redmine-580b591c57a0a70f7cf8a1dd34be85e0fcaa8b05.zip |
Add download link to no preview message (#26035).
Patch by Jan Schulz-Hofen.
git-svn-id: http://svn.redmine.org/redmine/trunk@16673 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/views/attachments/other.html.erb | 10 | ||||
-rw-r--r-- | app/views/common/_other.html.erb | 8 | ||||
-rw-r--r-- | app/views/repositories/entry.html.erb | 10 | ||||
-rw-r--r-- | config/locales/de.yml | 2 | ||||
-rw-r--r-- | config/locales/en.yml | 2 | ||||
-rw-r--r-- | config/locales/fr.yml | 4 | ||||
-rw-r--r-- | test/functional/attachments_controller_test.rb | 4 |
7 files changed, 34 insertions, 6 deletions
diff --git a/app/views/attachments/other.html.erb b/app/views/attachments/other.html.erb index e6244c16e..608bbf232 100644 --- a/app/views/attachments/other.html.erb +++ b/app/views/attachments/other.html.erb @@ -1,3 +1,11 @@ <%= render :layout => 'layouts/file' do %> - <%= render :partial => 'common/other' %> + <%= render :partial => 'common/other', + :locals => { + :download_link => link_to_attachment( + @attachment, + :text => l(:label_no_preview_download), + :download => true, + :class => 'icon icon-download' + ) + } %> <% end %> diff --git a/app/views/common/_other.html.erb b/app/views/common/_other.html.erb index fe0228a50..74d87a60a 100644 --- a/app/views/common/_other.html.erb +++ b/app/views/common/_other.html.erb @@ -1 +1,7 @@ -<p class="nodata"><%= l(:label_no_preview) %></p> +<p class="nodata"> + <% if defined? download_link %> + <%= t(:label_no_preview_alternative_html, link: download_link) %> + <% else %> + <%= l(:label_no_preview) %> + <% end %> +</p> diff --git a/app/views/repositories/entry.html.erb b/app/views/repositories/entry.html.erb index b495dd4ae..16bebc79c 100644 --- a/app/views/repositories/entry.html.erb +++ b/app/views/repositories/entry.html.erb @@ -17,7 +17,15 @@ <% elsif @content %> <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> <% else %> - <%= render :partial => 'common/other' %> + <%= render :partial => 'common/other', + :locals => { + :download_link => @repository.supports_cat? ? link_to( + l(:label_no_preview_download), + { :action => 'raw', :id => @project, + :repository_id => @repository.identifier_param, + :path => to_path_param(@path), + :rev => @rev }, + :class => 'icon icon-download') : nil } %> <% end %> <% content_for :header_tags do %> diff --git a/config/locales/de.yml b/config/locales/de.yml index 99a7c1ddf..d2e95b36c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -654,6 +654,8 @@ de: label_no_change_option: (Keine Änderung) label_no_data: Nichts anzuzeigen label_no_preview: Keine Vorschau verfügbar + label_no_preview_alternative_html: Keine Vorschau verfügbar. Sie können die Datei stattdessen %{link}. + label_no_preview_download: herunterladen label_no_issues_in_project: keine Tickets im Projekt label_nobody: Niemand label_none: kein diff --git a/config/locales/en.yml b/config/locales/en.yml index f2a8cbc0b..df57a57f3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -639,6 +639,8 @@ en: label_attribute_plural: Attributes label_no_data: No data to display label_no_preview: No preview available + label_no_preview_alternative_html: No preview available. %{link} the file instead. + label_no_preview_download: Download label_change_status: Change status label_history: History label_attachment: File diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ce9bb3eda..dea9e3e09 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1224,6 +1224,8 @@ fr: mail_body_security_notification_notify_enabled: Les notifications ont été activées pour l'adresse %{value} mail_body_security_notification_notify_disabled: Les notifications ont été désactivées pour l'adresse %{value} field_remote_ip: Adresse IP - label_no_preview: No preview available + label_no_preview: Aucun aperçu disponible + label_no_preview_alternative_html: Aucun aperçu disponible. Veuillez %{link} le fichier. + label_no_preview_download: télécharger label_user_mail_option_only_assigned: Only for things I watch or I am assigned to label_user_mail_option_only_owner: Only for things I watch or I am the owner of diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index b3cfda2cd..5a55f0c81 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -207,7 +207,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest } assert_response :success assert_equal 'text/html', @response.content_type - assert_select '.nodata', :text => 'No preview available' + assert_select '.nodata', :text => 'No preview available. Download the file instead.' end set_tmp_attachments_directory end @@ -228,7 +228,7 @@ class AttachmentsControllerTest < Redmine::ControllerTest :id => 6 } assert_equal 'text/html', @response.content_type - assert_select '.nodata', :text => 'No preview available' + assert_select '.nodata', :text => 'No preview available. Download the file instead.' set_tmp_attachments_directory end |