allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [29/42] git commit: [#7278] ticket:612 Add a way to extend details links
Date Mon, 25 Aug 2014 11:33:49 GMT
[#7278] ticket:612 Add a way to extend details links


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

Branch: refs/heads/je/42cc_7585
Commit: 1421708644b1b335356ee60d2155a9e2a6cc20a7
Parents: 6ee98c1
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue Aug 5 07:16:39 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Aug 21 18:49:56 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/site_admin.py                 | 12 +++++++++++-
 Allura/allura/lib/plugin.py                             | 10 ++++++++++
 Allura/allura/templates/site_admin_search_projects.html |  5 +++--
 3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/14217086/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index ebd1ff5..d92188d 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -34,7 +34,7 @@ from allura.app import SitemapEntry
 from allura.lib import helpers as h
 from allura.lib import validators as v
 from allura.lib.decorators import require_post
-from allura.lib.plugin import SiteAdminExtension
+from allura.lib.plugin import SiteAdminExtension, ProjectRegistrationProvider
 from allura.lib import search
 from allura.lib.security import require_access
 from allura.lib.widgets import form_fields as ffw
@@ -306,6 +306,15 @@ class SiteAdminController(object):
             if match:
                 count = match.hits
                 projects = match.docs
+                pids = [bson.ObjectId(p['id'].split('#')[1]) for p in projects]
+                mongo_projects = {}
+                for p in M.Project.query.find({'_id': {'$in': pids}}):
+                    mongo_projects[str(p._id)] = p
+
+                for i in range(len(projects)):
+                    p = projects[i]
+                    _id = p['id'].split('#')[1]
+                    p['project'] = mongo_projects[_id]
 
         def convert_fields(p):
             # throw the type away (e.g. '_s' from 'url_s')
@@ -327,6 +336,7 @@ class SiteAdminController(object):
             'page': page,
             'limit': limit,
             'additional_fields': aslist(config.get('search.project.additional_fields'), ','),
+            'provider': ProjectRegistrationProvider.get(),
         }
 
 

http://git-wip-us.apache.org/repos/asf/allura/blob/14217086/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 6e75edd..7f34559 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -854,6 +854,16 @@ class ProjectRegistrationProvider(object):
         '''
         return project._id.generation_time
 
+    def details_links(self, project):
+        '''Return list of pairs (url, label) with details
+        about the project.
+        Links will show up at admin project search page
+        '''
+        return [
+           (project.url() + 'admin/groups/', 'Members'),
+           (project.url() + 'admin/audit/', 'Audit Trail'),
+        ]
+
 
 class ThemeProvider(object):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/14217086/Allura/allura/templates/site_admin_search_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_search_projects.html b/Allura/allura/templates/site_admin_search_projects.html
index 41f37db..380df15 100644
--- a/Allura/allura/templates/site_admin_search_projects.html
+++ b/Allura/allura/templates/site_admin_search_projects.html
@@ -48,8 +48,9 @@
         <td>{{ p[field] }}</td>
         {% endfor %}
         <td>
-          <a href="{{ p['url'] + 'admin/groups/' }}">Members</a><br>
-          <a href="{{ p['url'] + 'admin/audit/' }}">Audit Trail</a>
+          {% for url, label in provider.details_links(p['project']) %}
+            <a href="{{ url }}">{{ label }}</a><br>
+          {% endfor %}
         </td>
       </tr>
     {% endfor %}


Mime
View raw message