[#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>
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 @@
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 @@
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':
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_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')