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 2016/08/03 15:06:55 UTC

[5/6] allura git commit: Added new method to list all MRs and fixed the inconsistencies with the MR filtering UI

Added new method to list all MRs and fixed the inconsistencies with the MR filtering UI


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

Branch: refs/heads/master
Commit: c7c520e2a026ef7130d1c082b264ec0004d7b630
Parents: 1a3e2c6
Author: Rohan Verma <ro...@gmail.com>
Authored: Wed Aug 3 16:47:21 2016 +0530
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Wed Aug 3 11:05:18 2016 -0400

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py          | 9 +++++++--
 Allura/allura/model/repository.py                | 5 +++++
 Allura/allura/templates/repo/merge_requests.html | 6 +++---
 3 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c7c520e2/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index fe2c9c9..82a2d7b 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -339,8 +339,13 @@ class MergeRequestsController(object):
     @with_trailing_slash
     @expose('jinja:allura:templates/repo/merge_requests.html')
     def index(self, status=None, **kw):
-        status = status or ['open']
-        requests = c.app.repo.merge_requests_by_statuses(*status)
+        status = status or 'open'
+        status = [status]
+        if status == ['all']:
+            requests = c.app.repo.all_merge_requests(*status)
+        else:
+            requests = c.app.repo.merge_requests_by_statuses(*status)
+
         return dict(
             status=status,
             requests=requests)

http://git-wip-us.apache.org/repos/asf/allura/blob/c7c520e2/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 1109216..5994642 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -633,6 +633,11 @@ class Repository(Artifact, ActivityObject):
             status={'$in': statuses})).sort(
             'request_number')
 
+    def all_merge_requests(self, *statuses):
+        return MergeRequest.query.find(dict(
+            app_config_id=self.app.config._id)).sort(
+            'request_number')
+
     @LazyProperty
     def _additional_viewable_extensions(self):
         ext_list = self.additional_viewable_extensions or ''

http://git-wip-us.apache.org/repos/asf/allura/blob/c7c520e2/Allura/allura/templates/repo/merge_requests.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/merge_requests.html b/Allura/allura/templates/repo/merge_requests.html
index 61341c9..2d6b8ae 100644
--- a/Allura/allura/templates/repo/merge_requests.html
+++ b/Allura/allura/templates/repo/merge_requests.html
@@ -30,9 +30,9 @@
     <form method="GET" action=".">
         <div class="btn-set">
             <button type="button" class="btn duo joined"><i class="fa fa-filter" aria-hidden="true"></i></button>
-            <button type="submit" class="btn duo joined {% if status == '' %}active{% endif %}" name="status" value="">All</button>
-            <button type="submit" class="btn duo joined {% if status == 'open' %}active{% endif %}" style="color:green" name="status" value="open">Open</button>
-            <button type="submit" class="btn duo joined {% if status == 'closed' %}active{% endif %}" style="color:red" name="status" value="closed">Closed</button>
+            <button type="submit" class="btn duo joined {% if status == 'all' %}active{% endif %}" name="status" value="all">All</button>
+            <button type="submit" class="btn duo joined {% if status == 'open' or status == '' %}active{% endif %}" style="color:green" name="status" value="open">Open</button>
+            <button type="submit" class="btn duo joined {% if status == 'rejected' %}active{% endif %}" style="color:red" name="status" value="rejected">Rejected</button>
             <button type="submit" class="btn duo joined {% if status == 'merged' %}active{% endif %}" style="color:DeepSkyBlue" name="status" value="merged">Merged</button>
         </div>
     </form>