From 0c6210fb3c26f15e5c788509468ca4651e072b54 Mon Sep 17 00:00:00 2001 From: Jan Schulz-Hofen Date: Wed, 24 May 2017 18:44:17 +0200 Subject: [PATCH 1/3] Move download link to contextual area --- 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 24bfd18..eb11f99 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 bdb5343..9c89561 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 082f555..0cbb94a 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.7.2