# HG changeset patch
# User Chris Cannam
# Date 1320751997 0
# Node ID 2034af722d0286fbad8f256084f490c6c218bfce
# Parent 882917cbe8d061b7b5edfe8597f86587cf113806# Parent 496b3cfa2f36bc0bcb3a9af69bae15b877628a21
Merge from branch "feature_318"
diff -r 882917cbe8d0 -r 2034af722d02 app/helpers/repositories_helper.rb
--- a/app/helpers/repositories_helper.rb Fri Nov 04 16:55:52 2011 +0000
+++ b/app/helpers/repositories_helper.rb Tue Nov 08 11:33:17 2011 +0000
@@ -281,4 +281,24 @@
) +
'
' + l(:text_scm_path_encoding_note))
end
+
+ # Generates a link to a downloadable archive for a revision
+ # Options:
+ # * :text - Link text (default to the formatted revision)
+ def link_to_revision_archive(repository, revision, project, options={})
+ method = repository.class.name.demodulize.underscore + "_link_to_revision_archive"
+ if repository.is_a?(Repository) &&
+ respond_to?(method) && method != 'link_to_revision_archive'
+ send(method, repository, revision, project, options)
+ end
+ end
+
+ def mercurial_link_to_revision_archive(repository, revision, project, options={})
+ text = options.delete(:text) || format_revision(revision)
+ rev = revision.respond_to?(:identifier) ? revision.identifier : revision
+ if rev.blank? then rev = 'tip' end
+ content_tag('a', h(text),
+ { :href => "/hg/#{project.identifier}/archive/#{rev}.zip" }.merge(options));
+ end
+
end
diff -r 882917cbe8d0 -r 2034af722d02 app/views/repositories/_navigation.rhtml
--- a/app/views/repositories/_navigation.rhtml Fri Nov 04 16:55:52 2011 +0000
+++ b/app/views/repositories/_navigation.rhtml Tue Nov 08 11:33:17 2011 +0000
@@ -2,7 +2,7 @@
<%= javascript_include_tag 'repository_navigation' %>
<% end %>
-<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %>
+<%= link_to_revision_archive(@repository, @changeset, @project, { :text => l(:label_download_revision), :class => 'icon icon-package' }) %>
<% form_tag({:action => controller.action_name, :id => @project, :path => to_path_param(@path), :rev => ''}, {:method => :get, :id => 'revision_selector'}) do -%>
@@ -19,3 +19,5 @@
| <%= l(:label_revision) %>:
<%= text_field_tag 'rev', @rev, :size => 8 %>
<% end -%>
+
+
diff -r 882917cbe8d0 -r 2034af722d02 app/views/repositories/revision.rhtml
--- a/app/views/repositories/revision.rhtml Fri Nov 04 16:55:52 2011 +0000
+++ b/app/views/repositories/revision.rhtml Tue Nov 08 11:33:17 2011 +0000
@@ -1,11 +1,15 @@
+<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %> +
+ <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:action => 'revisions', :id => @project, :key => User.current.rss_key} %> <% end %> + <% end %> <% end %> diff -r 882917cbe8d0 -r 2034af722d02 config/locales/en.yml --- a/config/locales/en.yml Fri Nov 04 16:55:52 2011 +0000 +++ b/config/locales/en.yml Tue Nov 08 11:33:17 2011 +0000 @@ -698,6 +698,7 @@ label_latest_revision_plural: Latest revisions label_view_revisions: View revisions label_view_all_revisions: View all revisions + label_download_revision: Download as Zip label_max_size: Maximum size label_sort_highest: Move to top label_sort_higher: Move up diff -r 882917cbe8d0 -r 2034af722d02 public/themes/soundsoftware/stylesheets/application.css --- a/public/themes/soundsoftware/stylesheets/application.css Fri Nov 04 16:55:52 2011 +0000 +++ b/public/themes/soundsoftware/stylesheets/application.css Tue Nov 08 11:33:17 2011 +0000 @@ -134,6 +134,8 @@ #footer { background-color: #fdfbf5; border: 0; border-top: 2px solid #a9b680; color: #3e442c; text-align: right; } #footer a { color: #be5700; font-weight: bold; } +p.statistics { text-align: right; font-size:0.9em; color: #666; } + #main { margin-top: 135px; font:95%; background: #fdfaf0; } #main a { font-weight: medium; color: #be5700;} #main a:hover { color: #be5700; text-decoration: underline; }