summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-17 09:51:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-17 09:51:19 +0000
commit580b591c57a0a70f7cf8a1dd34be85e0fcaa8b05 (patch)
tree77419f10ff7883b8d81cd186e2f419c46d3af908 /app
parent0a9b0dd46c917cacb6b04298c0d1aa3a0055a473 (diff)
downloadredmine-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
Diffstat (limited to 'app')
-rw-r--r--app/views/attachments/other.html.erb10
-rw-r--r--app/views/common/_other.html.erb8
-rw-r--r--app/views/repositories/entry.html.erb10
3 files changed, 25 insertions, 3 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 %>