allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [4/7] allura git commit: [#7922] ticket:826 Make menu collapsible
Date Mon, 03 Aug 2015 11:30:19 GMT
[#7922] ticket:826 Make menu collapsible


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

Branch: refs/heads/ib/7922
Commit: bcafc376dbec2ab07eba87f2dea46edb7f97c12b
Parents: 235907a
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Jul 31 13:33:43 2015 +0300
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Fri Jul 31 13:33:43 2015 +0300

----------------------------------------------------------------------
 Allura/allura/app.py                            |  9 +++++++++
 .../templates/jinja_master/sidebar_menu.html    | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/bcafc376/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 3aa8aad..67fff89 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -626,6 +626,15 @@ class Application(object):
         return links
 
     @LazyProperty
+    def admin_menu_collapse_button(self):
+        return SitemapEntry(
+            label='Admin',
+            url='#',
+            extra_html_attrs={
+                'id': 'sidebar-admin-menu-trigger',
+            })
+
+    @LazyProperty
     def admin_menu_delete_button(self):
         anchored_tools = self.project.neighborhood.get_anchored_tools()
         anchored = self.tool_label.lower() in anchored_tools.keys()

http://git-wip-us.apache.org/repos/asf/allura/blob/bcafc376/Allura/allura/templates/jinja_master/sidebar_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/sidebar_menu.html b/Allura/allura/templates/jinja_master/sidebar_menu.html
index 9a81035..752440c 100644
--- a/Allura/allura/templates/jinja_master/sidebar_menu.html
+++ b/Allura/allura/templates/jinja_master/sidebar_menu.html
@@ -55,7 +55,26 @@
     {% endif %}
     {% if c.app %}
       {% if h.has_access(c.app, 'admin')() %}
+        <style>
+          #sidebar-admin-menu.hide ul li:not(:first-child) {
+            display: none;
+          }
+          #sidebar-admin-menu.hide ul li:first-child {
+            border-bottom: medium none;
+          }
+        </style>
+        <div id='sidebar-admin-menu' class='hide'>
         {% for s in c.app.admin_menu() %}
+          {% if loop.first %}
+            {{sidebar_item(c.app.admin_menu_collapse_button)}}
+            <script>
+              $('#sidebar-admin-menu-trigger').click(function(e) {
+                e.preventDefault();
+                $(this).parents('li').toggleClass('active');
+                $('#sidebar-admin-menu').toggleClass('hide');
+              });
+            </script>
+          {% endif %}
           {{sidebar_item(s)}}
         {% endfor %}
         {{sidebar_item(c.app.admin_menu_delete_button)}}
@@ -64,6 +83,7 @@
         {% if c.app.admin_menu_delete_button %}
           {{c.app.admin_tool_delete_modal.display()}}
         {% endif %}
+        </div>
       {% endif %}
       {% for s in c.app.sidebar_menu() %}
         {{sidebar_item(s)}}


Mime
View raw message