# HG changeset patch # User Chris Cannam # Date 1320686983 0 # Node ID 496b3cfa2f36bc0bcb3a9af69bae15b877628a21 # Parent 8873bc7c1af5b046a16abd430ba9899f3d36a7dc Finish adding download link diff -r 8873bc7c1af5 -r 496b3cfa2f36 app/helpers/repositories_helper.rb --- a/app/helpers/repositories_helper.rb Fri Nov 04 17:56:58 2011 +0000 +++ b/app/helpers/repositories_helper.rb Mon Nov 07 17:29:43 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 8873bc7c1af5 -r 496b3cfa2f36 app/views/repositories/_navigation.rhtml --- a/app/views/repositories/_navigation.rhtml Fri Nov 04 17:56:58 2011 +0000 +++ b/app/views/repositories/_navigation.rhtml Mon Nov 07 17:29:43 2011 +0000 @@ -2,12 +2,7 @@ <%= javascript_include_tag 'repository_navigation' %> <% end %> -<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %> - -| .zip">Download this revision +<%= 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 -%> @@ -24,3 +19,5 @@ | <%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 8 %> <% end -%> + + diff -r 8873bc7c1af5 -r 496b3cfa2f36 app/views/repositories/revision.rhtml --- a/app/views/repositories/revision.rhtml Fri Nov 04 17:56:58 2011 +0000 +++ b/app/views/repositories/revision.rhtml Mon Nov 07 17:29:43 2011 +0000 @@ -1,11 +1,15 @@
+ + <%= link_to_revision_archive(@repository, @changeset, @project, { :text => l(:label_download_revision), :class => 'icon icon-package' }) %> +    + « <% unless @changeset.previous.nil? -%> <%= link_to_revision(@changeset.previous, @project, :text => l(:label_previous)) %> <% else -%> <%= l(:label_previous) %> <% end -%> -| + <% unless @changeset.next.nil? -%> <%= link_to_revision(@changeset.next, @project, :text => l(:label_next)) %> <% else -%> @@ -21,6 +25,7 @@ <%= text_field_tag 'rev', @rev, :size => 8 %> <%= submit_tag 'OK', :name => nil %> <% end %> +

<%= l(:label_revision) %> <%= format_revision(@changeset) %>

diff -r 8873bc7c1af5 -r 496b3cfa2f36 app/views/repositories/show.rhtml --- a/app/views/repositories/show.rhtml Fri Nov 04 17:56:58 2011 +0000 +++ b/app/views/repositories/show.rhtml Mon Nov 07 17:29:43 2011 +0000 @@ -51,9 +51,14 @@ :id => @project, :page => nil, :key => User.current.rss_key})) %> <% end %> +

+<%= 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 8873bc7c1af5 -r 496b3cfa2f36 config/locales/en.yml --- a/config/locales/en.yml Fri Nov 04 17:56:58 2011 +0000 +++ b/config/locales/en.yml Mon Nov 07 17:29:43 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 8873bc7c1af5 -r 496b3cfa2f36 public/themes/soundsoftware/stylesheets/application.css --- a/public/themes/soundsoftware/stylesheets/application.css Fri Nov 04 17:56:58 2011 +0000 +++ b/public/themes/soundsoftware/stylesheets/application.css Mon Nov 07 17:29:43 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; }