From 0a9b0dd46c917cacb6b04298c0d1aa3a0055a473 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Jun 2017 09:49:41 +0000 Subject: [PATCH] Move download link to contextual area (#26035). Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@16672 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/layouts/_file.html.erb | 6 ++++-- app/views/repositories/_link_to_functions.html.erb | 9 --------- app/views/repositories/_navigation.html.erb | 9 +++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/layouts/_file.html.erb b/app/views/layouts/_file.html.erb index 24bfd1843..eb11f9931 100644 --- a/app/views/layouts/_file.html.erb +++ b/app/views/layouts/_file.html.erb @@ -1,10 +1,12 @@ +
+ <%= link_to_attachment @attachment, :text => "#{l(:button_download)} (#{number_to_human_size(@attachment.filesize)})", :download => true, :class => 'icon icon-download' -%> +
+

<%=h @attachment.filename %>

<%= "#{@attachment.description} - " unless @attachment.description.blank? %> <%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %>

-

<%= link_to_attachment @attachment, :text => l(:button_download), :download => true, :class => 'icon icon-download' -%> - (<%= number_to_human_size @attachment.filesize %>)

<%= yield %> diff --git a/app/views/repositories/_link_to_functions.html.erb b/app/views/repositories/_link_to_functions.html.erb index bdb534395..9c89561c3 100644 --- a/app/views/repositories/_link_to_functions.html.erb +++ b/app/views/repositories/_link_to_functions.html.erb @@ -16,13 +16,4 @@ tabs << { name: 'annotate', label: :button_annotate, <%= render :partial => 'common/tabs', :locals => {:tabs => tabs, :selected_tab => action_name} %> -

-<%= link_to(l(:button_download), - {:action => 'raw', :id => @project, - :repository_id => @repository.identifier_param, - :path => to_path_param(@path), - :rev => @rev}, class: 'icon icon-download') if @repository.supports_cat? %> -<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %> -

- <% end %> diff --git a/app/views/repositories/_navigation.html.erb b/app/views/repositories/_navigation.html.erb index 082f55575..0cbb94ae6 100644 --- a/app/views/repositories/_navigation.html.erb +++ b/app/views/repositories/_navigation.html.erb @@ -2,6 +2,15 @@ <%= javascript_include_tag 'repository_navigation' %> <% end %> +<% if @entry && @repository.supports_cat? %> + <% download_label = @entry.size ? "#{l :button_download} (#{number_to_human_size @entry.size})" : l(:button_download) %> + <%= link_to(download_label, + {:action => 'raw', :id => @project, + :repository_id => @repository.identifier_param, + :path => to_path_param(@path), + :rev => @rev}, class: 'icon icon-download') %> +<% end %> + <%= link_to l(:label_statistics), {:action => 'stats', :id => @project, :repository_id => @repository.identifier_param}, :class => 'icon icon-stats' if @repository.supports_all_revisions? %> -- 2.39.5