Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B398010645 for ; Wed, 10 Apr 2013 16:15:00 +0000 (UTC) Received: (qmail 24254 invoked by uid 500); 10 Apr 2013 16:15:00 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 24232 invoked by uid 500); 10 Apr 2013 16:15:00 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 24223 invoked by uid 99); 10 Apr 2013 16:15:00 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2013 16:15:00 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 64B71818B98; Wed, 10 Apr 2013 16:15:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Date: Wed, 10 Apr 2013 16:15:01 -0000 Message-Id: <25ff671f8684456e86f08d4c42ae2d80@git.apache.org> In-Reply-To: <8ddc24647cff42d084d5b1ad98fc8302@git.apache.org> References: <8ddc24647cff42d084d5b1ad98fc8302@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] git commit: [#5120] Only show first 10 branches, like with tags [#5120] Only show first 10 branches, like with tags Signed-off-by: Cory Johns Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5a72eb23 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5a72eb23 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5a72eb23 Branch: refs/heads/cj/5120 Commit: 5a72eb233a314cf462e3cce380070acbbf616d55 Parents: 3fe91a2 Author: Cory Johns Authored: Wed Apr 10 16:14:45 2013 +0000 Committer: Cory Johns Committed: Wed Apr 10 16:14:45 2013 +0000 ---------------------------------------------------------------------- Allura/allura/controllers/repository.py | 5 +++ Allura/allura/lib/repository.py | 41 ++++++++++++------------- Allura/allura/templates/repo/tags.html | 10 +++--- 3 files changed, 30 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a72eb23/Allura/allura/controllers/repository.py ---------------------------------------------------------------------- diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py index dca0ceb..f2935a9 100644 --- a/Allura/allura/controllers/repository.py +++ b/Allura/allura/controllers/repository.py @@ -392,6 +392,11 @@ class BranchBrowser(BaseController): def tags(self, **kw): return dict(tags=c.app.repo.repo_tags) + @expose('jinja:allura:templates/repo/tags.html') + @with_trailing_slash + def branches(self, **kw): + return dict(title='Branches', tags=c.app.repo.branches) + @expose() @with_trailing_slash def log(self, **kw): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a72eb23/Allura/allura/lib/repository.py ---------------------------------------------------------------------- diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py index 79a6b33..dfcaf4f 100644 --- a/Allura/allura/lib/repository.py +++ b/Allura/allura/lib/repository.py @@ -80,13 +80,6 @@ class RepositoryApp(Application): def sidebar_menu(self): if not self.repo or self.repo.status != 'ready': return [] - if self.default_branch_name: - default_branch_url = ( - c.app.url - + url(quote(self.default_branch_name + self.END_OF_REF_ESCAPE)) - + '/') - else: - default_branch_url = c.app.url links = [SitemapEntry('Browse Commits', c.app.url + 'commit_browser', ui_icon=g.icons['folder'])] if self.forkable and self.repo.status == 'ready': links.append(SitemapEntry('Fork', c.app.url + 'fork', ui_icon=g.icons['fork'])) @@ -118,27 +111,33 @@ class RepositoryApp(Application): 'Pending Merges', self.repo.upstream_repo.name + 'merge-requests/', small=pending_upstream_merges)) + ref_url = self.repo.url_for_commit(self.default_branch_name, url_type='ref') if self.repo.branches: links.append(SitemapEntry('Branches')) - for b in self.repo.branches: + max_branches = 10 + for b in self.repo.branches[:max_branches]: links.append(SitemapEntry( - b.name, url('%sci/%s/tree/' % (c.app.url, quote(b.name, safe=''))), + b.name, self.repo.url_for_commit(b.name)+'tree/', small=b.count)) + if len(self.repo.branches) > max_branches: + links.append( + SitemapEntry( + 'More Branches', + ref_url + 'branches/', + )) if self.repo.repo_tags: links.append(SitemapEntry('Tags')) max_tags = 10 - for i, b in enumerate(self.repo.repo_tags): - if i < max_tags: - links.append(SitemapEntry( - b.name, url('%sci/%s/tree/' % (c.app.url, quote(b.name, safe=''))), - small=b.count)) - elif i == max_tags: - links.append( - SitemapEntry( - 'More Tags', - default_branch_url+'tags/', - )) - break + for b in self.repo.repo_tags[:max_tags]: + links.append(SitemapEntry( + b.name, self.repo.url_for_commit(b.name)+'tree/', + small=b.count)) + if len(self.repo.repo_tags) > max_tags: + links.append( + SitemapEntry( + 'More Tags', + ref_url + 'tags/', + )) return links def install(self, project): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a72eb23/Allura/allura/templates/repo/tags.html ---------------------------------------------------------------------- diff --git a/Allura/allura/templates/repo/tags.html b/Allura/allura/templates/repo/tags.html index 148c28f..8252733 100644 --- a/Allura/allura/templates/repo/tags.html +++ b/Allura/allura/templates/repo/tags.html @@ -2,18 +2,18 @@ {% block title %} {% if c.app.repo %} - Tags: {{c.app.repo.name}} + {{title or 'Tags'}}: {{c.app.repo.name}} {% else %} - Tags + {{title or 'Tags'}} {% endif %} {% endblock %} -{% block header %}{{c.app.config.options.mount_label}} Tags{% endblock %} +{% block header %}{{c.app.config.options.mount_label}} {{title or 'Tags'}}{% endblock %} {% block content %}
- {% for b in c.app.repo.repo_tags %} - {{b.name}}
+ {% for b in tags %} + {{b.name}}
{% endfor %}
{% endblock %}