Beispiel #1
0
 def view_nth_level_only(self, params=None):
     n = int(params[0]) if params else 0
     classes = 'nth-level ' + ('horizontal' if not params or len(params) < 2 else params[1])
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     parents_only = []
     for item, _ in hierarchy:
         item['is_ancestor'] = section.is_ancestor(self.section.path, item['path'])
         parents_only.append([item, []])
     self.section.css.append('nav-nth-level.css')
     return list_ul(self.section.path, parents_only, classes)
Beispiel #2
0
 def view_nth_level_only(self, params=None):
     n = int(params[0]) if params else 0
     classes = 'nth-level ' + ('horizontal' if not params or len(params) < 2 else params[1])
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     parents_only = []
     for item, _ in hierarchy:
         item['is_ancestor'] = section.is_ancestor(self.section.path, item['path'])
         parents_only.append([item, []])
     self.section.css.append('nav-nth-level.css')
     return list_ul(self.section.path, parents_only, classes)
Beispiel #3
0
 def view_dropdown(self, params=None):
     n = int(params[0]) if params else 0
     dropdown_type = 'vertical' if not params or len(params) < 2 else params[1]
     classes = 'dropdown-' + dropdown_type
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     hierarchy = set_ancestry(self.section.path, hierarchy)
     self.section.yuijs.append('yui/yui.js')
     if dropdown_type == 'horizontal':
         self.section.css.append('nav-dropdown-h.css')
         self.section.js.append('nav-dropdown-h.js')
     else:
         self.section.js.append('nav-dropdown-v.js')
     return list_ul(self.section.path, hierarchy, classes, dropdown_id=self.unique_identifier(), dropdown_type=dropdown_type)
Beispiel #4
0
 def view_expanding_hierarchy(self, params=None):
     n = int(params[0]) if params else 0
     classes = 'expanding-hierarchy ' + ('vertical' if not params or len(params) < 2 else params[1])
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     for item in hierarchy:
         if section.is_ancestor(self.section.path, item[0]['path']):
             item[0]['is_ancestor'] = True
             item[1] = set_ancestry_hide_others(self.section.path, item[1])
         else:
             item[0]['is_ancestor'] = False
             item[1] = None
     self.section.css.append('nav-expanding-hierarchy.css')
     return list_ul(self.section.path, hierarchy, classes)
Beispiel #5
0
 def view_dropdown(self, params=None):
     n = int(params[0]) if params else 0
     dropdown_type = 'vertical' if not params or len(params) < 2 else params[1]
     classes = 'dropdown-' + dropdown_type
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     hierarchy = set_ancestry(self.section.path, hierarchy)
     self.section.yuijs.append('yui/yui.js')
     if dropdown_type == 'horizontal':
         self.section.css.append('nav-dropdown-h.css')
         self.section.js.append('nav-dropdown-h.js')
     else:
         self.section.js.append('nav-dropdown-v.js')
     return list_ul(self.section.path, hierarchy, classes, dropdown_id=self.unique_identifier(), dropdown_type=dropdown_type)
Beispiel #6
0
 def view_expanding_hierarchy(self, params=None):
     n = int(params[0]) if params else 0
     classes = 'expanding-hierarchy ' + ('vertical' if not params or len(params) < 2 else params[1])
     hierarchy = section.get_top_level()
     while n:
         for h in hierarchy:
             if section.is_ancestor(self.section.path, h[0]['path']):
                 hierarchy = h[1]
         n -= 1
     for item in hierarchy:
         if section.is_ancestor(self.section.path, item[0]['path']):
             item[0]['is_ancestor'] = True
             item[1] = set_ancestry_hide_others(self.section.path, item[1])
         else:
             item[0]['is_ancestor'] = False
             item[1] = None
     self.section.css.append('nav-expanding-hierarchy.css')
     return list_ul(self.section.path, hierarchy, classes)
Beispiel #7
0
 def action_manage(self):
     ret = '<h2>Manage sections</h2>'
     ret += list_ul(self.section.path, section.get_top_level(), 'manage', True)
     self.section.css.append('nav-manage.css')
     return ret
Beispiel #8
0
 def action_manage(self):
     ret = '<h2>Manage sections</h2>'
     ret += list_ul(self.section.path, section.get_top_level(), 'manage', True)
     self.section.css.append('nav-manage.css')
     return ret