incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [41/50] git commit: [#6765] Make admin tool last in nav for imported projects too
Date Tue, 22 Oct 2013 21:50:51 GMT
[#6765] Make admin tool last in nav for imported projects too

Instead of changing the actual ordinal of the admin tool, just update
the sort key so it gets moved to the end of the sitemap list

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


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

Branch: refs/heads/cj/6422
Commit: 80247fc254b201538565e7dbfff654e71a38b3fb
Parents: ec52a0e
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Thu Oct 17 19:28:27 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Oct 17 19:28:27 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py            | 3 ++-
 Allura/allura/tests/model/test_project.py | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/80247fc2/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 4a56c1b..5ac1810 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -461,7 +461,6 @@ class Project(MappedClass, ActivityNode, ActivityObject):
         anchored_tools = self.neighborhood.get_anchored_tools()
         i = len(anchored_tools)
         new_tools = self.install_anchored_tools()
-        self.app_config('admin').options.ordinal = 100
 
         # Set menu mode
         delta_ordinal = i
@@ -490,6 +489,8 @@ class Project(MappedClass, ActivityNode, ActivityObject):
                     entry.ui_icon = 'tool-%s' % entry.tool_name.lower()
                     if not self.is_nbhd_project and (entry.tool_name.lower() in anchored_tools.keys()):
                         ordinal = anchored_tools.keys().index(entry.tool_name.lower())
+                    elif ac.tool_name == 'admin':
+                        ordinal = 100
                     else:
                         ordinal = int(ac.options.get('ordinal', 0)) + delta_ordinal
                     if self.is_nbhd_project and entry.label == 'Admin':

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/80247fc2/Allura/allura/tests/model/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_project.py b/Allura/allura/tests/model/test_project.py
index c346107..1005ba8 100644
--- a/Allura/allura/tests/model/test_project.py
+++ b/Allura/allura/tests/model/test_project.py
@@ -114,10 +114,10 @@ def test_anchored_tools():
 
 def test_set_ordinal_to_admin_tool():
     with h.push_config(c,
-                       user=M.User.anonymous(),
+                       user=M.User.by_username('test-admin'),
                        project=M.Project.query.get(shortname='test')):
-        assert c.project.sitemap()
-        assert c.project.app_config('admin').options.ordinal == 100
+        sm = c.project.sitemap()
+        assert_equals(sm[-1].tool_name, 'admin')
 
 def test_users_and_roles():
     p = M.Project.query.get(shortname='test')


Mime
View raw message