From 580b591c57a0a70f7cf8a1dd34be85e0fcaa8b05 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Jun 2017 09:51:19 +0000 Subject: 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 --- app/views/attachments/other.html.erb | 10 +++++++++- app/views/common/_other.html.erb | 8 +++++++- app/views/repositories/entry.html.erb | 10 +++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) (limited to 'app/views') 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 @@ -

<%= l(:label_no_preview) %>

+

+ <% if defined? download_link %> + <%= t(:label_no_preview_alternative_html, link: download_link) %> + <% else %> + <%= l(:label_no_preview) %> + <% end %> +

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 %> -- cgit v1.2.3