You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/24 19:04:59 UTC

[23/50] git commit: [#6046] ticket:350 Fix 'Download Snapshot' link in repo subdirs

[#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/db/6255
Commit: 6e53ab07329fdd74cb6d1b2405bda677202c77b9
Parents: a5961a6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 10 09:31:20 2013 +0000
Committer: Cory Johns <cj...@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 %}