Esempio n. 1
0
    def nav_recurse(self):
        """Recursive view for the "tree" display type.
        """
        display_manner = get_setting(self.location + '_display_manner', default='pills')
        options = get_setting(self.location + '_options', default=[])
        tree_is_open_all = 'open_all' in options
        nav_class = get_nav_class(self.location)

        return {'tree_is_open_all': tree_is_open_all,
                'is_node_open': is_node_open,
                'nav_class': nav_class,
                'children': get_children(self.context,
                                         self.request,
                                         self.location),
                }
Esempio n. 2
0
    def navigation_widget_tree(self):
        """Views for display type "tree", continued:
          - These are the main views for the tree display type, each using the
            general navigation_widget_tree() view function.
          - The nav recurse view above is called from nav_widget_tree.pt,
            used in each of these.
        """
        resource_group.need()
        root = get_root()

        display_type = get_setting(self.location + '_display_type')
        options = get_setting(self.location + '_options')
        if 'dropdowns' in options:
            dropdown_resource_group.need()

        include_root = 'include_root' in options
        show_menu = 'show_menu' in options
        label = get_setting(self.location + '_label')
        if label:
            label = parse_label(self.context.title, label)

        # When the nav display is set to the beforebodyend slot, the class
        # for the containing div needs to be 'container' so it fits to the
        # middle span12 area for content. When nav is in any of the other
        # slots, no class is needed, because the inherited CSS works to fit
        # nav to the slot.
        use_container_class = self.location == 'beforebodyend'

        items = get_children(root, self.request, self.location)
        tree_is_open_all = 'open_all' in options
        nav_class = get_nav_class(self.location)

        return {'location': self.location,
                'root': root,
                'display_type': display_type,
                'include_root': include_root,
                'show_menu': show_menu,
                'show_divider': show_menu and self.location != 'top' and items,
                'nav_class': nav_class,
                'tree_is_open_all': tree_is_open_all,
                'is_node_open': is_node_open,
                'use_container_class': use_container_class,
                'items': items,
                'label': label,
                'dropdowns': 'dropdowns' in options,
                'hidden': ''}
    def navigation_widget_tree(self):
        """Views for display type "tree", continued:
          - These are the main views for the tree display type, each using the
            general navigation_widget_tree() view function.
          - The nav recurse view above is called from nav_widget_tree.pt,
            used in each of these.
        """
        resource_group.need()
        root = get_root()

        display_type = get_setting(self.location + "_display_type")
        options = get_setting(self.location + "_options")

        include_root = "include_root" in options
        show_menu = "show_menu" in options
        label = get_setting(self.location + "_label")
        if label:
            label = parse_label(self.context.title, label)

        # When the nav display is set to the beforebodyend slot, the class
        # for the containing div needs to be 'container' so it fits to the
        # middle span12 area for content. When nav is in any of the other
        # slots, no class is needed, because the inherited CSS works to fit
        # nav to the slot.
        use_container_class = self.location == "beforebodyend"

        items = get_children(root, self.request, self.location)
        tree_is_open_all = "open_all" in options
        nav_class = get_nav_class(options)

        return {
            "location": self.location,
            "root": root,
            "display_type": display_type,
            "include_root": include_root,
            "show_menu": show_menu,
            "show_divider": show_menu and self.location != "top" and items,
            "nav_class": nav_class,
            "tree_is_open_all": tree_is_open_all,
            "is_node_open": is_node_open,
            "use_container_class": use_container_class,
            "items": items,
            "label": label,
        }
Esempio n. 4
0
    def navigation_widget_items(self):
        """Views for the "items" display type, a term used to avoid confusion
           that comes with calling this a "list" -- there are horizontal lists
           and there are vertical aspect lists. We distinguish here that the
           following views are not recursive and tree-like. They offer a
           limited list of items for the current context.
           - They each use the general navigation_widget_items() view function.
        """
        resource_group.need()

        display_type = get_setting(self.location + '_display_type')
        options = get_setting(self.location + '_options', default=[])
        nav_class = get_nav_class(self.location)

        # When the nav display is set to the beforebodyend slot, the class
        # for the containing div needs to be 'container' so it fits to the
        # middle span12 area for content. When nav is in any of the other
        # slots, no class is needed, because the inherited CSS works to fit
        # nav to the slot.
        use_container_class = self.location == 'beforebodyend'

        items = get_children(self.context, self.request, self.location)

        allowed_children = []
        for item in items:
            ac = get_children(item, self.request, self.location)
            allowed_children.append(ac if ac else [])

        label = parse_label(self.context.title,
                            get_setting(self.location + '_label'))

        careted = (display_type == 'items') and\
                    ('dropdowns' in options)

        return {'location': self.location,
                'items': items,
                'display_type': display_type,
                'nav_class': nav_class,
                'use_container_class': use_container_class,
                'show_menu': 'show_menu' in options,
                'allowed_children': allowed_children,
                'label': label,
                'dropdowns': 'dropdowns' in options,
            }