From 3f80a89a69b2a6f3290c4ebec3a693c86eccee6a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 22 Dec 2008 20:33:01 +0000 Subject: [PATCH] Show view/annotate/download links on repositories/entries and repositories/annotate views (#2367). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2167 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 3 +++ app/views/repositories/_link_to_functions.rhtml | 10 ++++++++++ app/views/repositories/annotate.rhtml | 2 ++ app/views/repositories/changes.rhtml | 11 +---------- app/views/repositories/entry.rhtml | 2 ++ 5 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 app/views/repositories/_link_to_functions.rhtml diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index dc2acee3a..3cec2e8e5 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -127,6 +127,9 @@ class RepositoriesController < ApplicationController end def annotate + @entry = @repository.entry(@path, @rev) + show_error_not_found and return unless @entry + @annotate = @repository.scm.annotate(@path, @rev) render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty? end diff --git a/app/views/repositories/_link_to_functions.rhtml b/app/views/repositories/_link_to_functions.rhtml new file mode 100644 index 000000000..9461c99a8 --- /dev/null +++ b/app/views/repositories/_link_to_functions.rhtml @@ -0,0 +1,10 @@ +

+<% if @repository.supports_cat? %> + <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | +<% end %> +<% if @repository.supports_annotate? %> + <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | +<% end %> +<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %> +<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %> +

diff --git a/app/views/repositories/annotate.rhtml b/app/views/repositories/annotate.rhtml index b5669ef76..44b5a81a6 100644 --- a/app/views/repositories/annotate.rhtml +++ b/app/views/repositories/annotate.rhtml @@ -1,5 +1,7 @@

<%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %>

+

<%= render :partial => 'link_to_functions' %>

+ <% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
diff --git a/app/views/repositories/changes.rhtml b/app/views/repositories/changes.rhtml index ca5c58328..aa359ef4d 100644 --- a/app/views/repositories/changes.rhtml +++ b/app/views/repositories/changes.rhtml @@ -1,15 +1,6 @@

<%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %>

-

-<% if @repository.supports_cat? %> - <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | -<% end %> -<% if @repository.supports_annotate? %> - <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => to_path_param(@path), :rev => @rev } %> | -<% end %> -<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %> -<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %> -

+

<%= render :partial => 'link_to_functions' %>

<%= render_properties(@properties) %> diff --git a/app/views/repositories/entry.rhtml b/app/views/repositories/entry.rhtml index 8e1e1992c..12ba9f428 100644 --- a/app/views/repositories/entry.rhtml +++ b/app/views/repositories/entry.rhtml @@ -1,5 +1,7 @@

<%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %>

+

<%= render :partial => 'link_to_functions' %>

+ <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %> <% content_for :header_tags do %>