changeset 3580:7b9d4f6bb04e beta

show only open pull requests in the counter, and use repo context bar in pull requests view
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 24 Mar 2013 20:24:17 +0100
parents 11feddcd75bb
children 93d912ea8cb1
files rhodecode/lib/base.py rhodecode/model/scm.py rhodecode/templates/pullrequests/pullrequest.html rhodecode/templates/pullrequests/pullrequest_show.html rhodecode/templates/pullrequests/pullrequest_show_all.html
diffstat 5 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/base.py	Sun Mar 24 19:58:24 2013 +0100
+++ b/rhodecode/lib/base.py	Sun Mar 24 20:24:17 2013 +0100
@@ -266,8 +266,7 @@
         c.visual.lightweight_dashboard = str2bool(rc_config.get('rhodecode_lightweight_dashboard'))
         c.visual.lightweight_dashboard_items = safe_int(config.get('dashboard_items', 100))
         c.visual.repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
-
-        c.repo_name = get_repo_slug(request)
+        c.repo_name = get_repo_slug(request)  # can be empty
         c.backends = BACKENDS.keys()
         c.unread_notifications = NotificationModel()\
                         .get_unread_cnt_for_user(c.rhodecode_user.user_id)
--- a/rhodecode/model/scm.py	Sun Mar 24 19:58:24 2013 +0100
+++ b/rhodecode/model/scm.py	Sun Mar 24 20:24:17 2013 +0100
@@ -393,7 +393,8 @@
     def get_pull_requests(self, repo):
         repo = self._get_repo(repo)
         return self.sa.query(PullRequest)\
-                .filter(PullRequest.other_repo == repo).count()
+                .filter(PullRequest.other_repo == repo)\
+                .filter(PullRequest.status != PullRequest.STATUS_CLOSED).count()
 
     def mark_as_fork(self, repo, fork, user):
         repo = self.__get_repo(repo)
--- a/rhodecode/templates/pullrequests/pullrequest.html	Sun Mar 24 19:58:24 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest.html	Sun Mar 24 20:24:17 2013 +0100
@@ -13,7 +13,7 @@
 </%def>
 
 <%def name="main()">
-
+${self.context_bar('showpullrequest')}
 <div class="box">
     <!-- box / title -->
     <div class="title">
--- a/rhodecode/templates/pullrequests/pullrequest_show.html	Sun Mar 24 19:58:24 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest_show.html	Sun Mar 24 20:24:17 2013 +0100
@@ -13,7 +13,7 @@
 </%def>
 
 <%def name="main()">
-
+${self.context_bar('showpullrequest')}
 <div class="box">
     <!-- box / title -->
     <div class="title">
--- a/rhodecode/templates/pullrequests/pullrequest_show_all.html	Sun Mar 24 19:58:24 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest_show_all.html	Sun Mar 24 20:24:17 2013 +0100
@@ -35,6 +35,4 @@
 
 </div>
 
-<script type="text/javascript"></script>
-
 </%def>