incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [01/50] git commit: [#6046] ticket:350 Fix 'Download Snapshot' link in repo subdirs
Date Tue, 28 May 2013 16:00:53 GMT
Updated Branches:
  refs/heads/cj/5913 daf172b05 -> 961786ff0 (forced update)


[#6046] ticket:350 Fix 'Download Snapshot' link in repo subdirs


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6e53ab07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6e53ab07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6e53ab07

Branch: refs/heads/cj/5913
Commit: 6e53ab07329fdd74cb6d1b2405bda677202c77b9
Parents: a5961a6
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri May 10 09:31:20 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Thu May 23 01:18:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |    8 +++++++-
 Allura/allura/templates/repo/tree.html  |    4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6e53ab07/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 8ccd36d..6967685 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -516,6 +516,12 @@ class TreeBrowser(BaseController, DispatchIndex):
         c.tree_widget = self.tree_widget
         c.subscribe_form = self.subscribe_form
         tool_subscribed = M.Mailbox.subscribed()
+        tarball_url = None
+        if asbool(tg.config.get('scm.repos.tarball.enable', False)):
+            cutout = len('tree' + self._path)
+            if request.path.endswith('/') and not self._path.endswith('/'):
+                cutout += 1
+            tarball_url = '%starball' % request.path[:-cutout]
         return dict(
             repo=c.app.repo,
             commit=self._commit,
@@ -523,7 +529,7 @@ class TreeBrowser(BaseController, DispatchIndex):
             path=self._path,
             parent=self._parent,
             tool_subscribed=tool_subscribed,
-            tarball_enable = asbool(tg.config.get('scm.repos.tarball.enable', False)))
+            tarball_url=tarball_url)
 
     @expose()
     def _lookup(self, next, *rest):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6e53ab07/Allura/allura/templates/repo/tree.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tree.html b/Allura/allura/templates/repo/tree.html
index 51b22f8..740ed04 100644
--- a/Allura/allura/templates/repo/tree.html
+++ b/Allura/allura/templates/repo/tree.html
@@ -30,8 +30,8 @@ Tree <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(co
 {% endblock %}
 
 {% block actions %}
-{% if tarball_enable %}
-    <a href="{{request.path[:-5]}}tarball" rel="nofollow">
+{% if tarball_url %}
+    <a href="{{tarball_url}}" rel="nofollow">
         <b data-icon="{{g.icons.folder.char}}" class="ico {{g.icons.folder.css}}" title="Snapshot">
</b> Download Snapshot
 </a>
 {% endif %}


Mime
View raw message