Allura/allura/model/project.py
def grouped_navbar_entries(self):
        """Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
        the project navbar with tools grouped together by tool type.
        """
        # get orginal (non-grouped) navbar entries
        sitemap = self.sitemap()
        # ordered dict to preserve the orginal ordering of tools
        grouped_nav = OrderedDict()
        # count how many tools of each type we have
        counts = Counter([e.tool_name.lower() for e in sitemap if e.tool_name])
        grouping_threshold = self.get_tool_data(
            'allura', 'grouping_threshold', 1)
        for e in sitemap:
            # if it's not a tool, add to navbar and continue
            if not e.tool_name:
                grouped_nav[id(e)] = e
                continue
            tool_name = e.tool_name.lower()
            if counts.get(tool_name, 1) <= grouping_threshold:
                # don't need grouping, so just add it directly
                grouped_nav[id(e)] = e
            else:
                # tool of a type we don't have in the navbar yet
                if tool_name not in grouped_nav:
                    child = deepcopy(e)
                    # change label to be the tool name (type)
                    e.label = g.entry_points['tool'][
                        tool_name].tool_label + u' \u25be'
                    # add tool url to list of urls that will match this nav entry
                    # have to do this before changing the url to the list page
                    e.matching_urls.append(e.url)
                    # change url to point to tool list page
                    e.url = self.url() + '_list/' + tool_name
                    e.children.append(child)
                    grouped_nav[tool_name] = e
                else:
                    # add tool url to list of urls that will match this nav
                    # entry
                    grouped_nav[tool_name].matching_urls.append(e.url)
                    if len(grouped_nav[tool_name].children) < SITEMAP_PER_TOOL_LIMIT - 1:
                        grouped_nav[tool_name].children.append(e)
                    elif len(grouped_nav[tool_name].children) == SITEMAP_PER_TOOL_LIMIT - 1:
                        e.url = self.url() + '_list/' + tool_name
                        e.label = 'More...'
                        grouped_nav[tool_name].children.append(e)
        return grouped_nav.values()
Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
        the project navbar with tools grouped together by tool type.
        
Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
the project navbar with tools grouped together by tool type.
Return a : class : ` ~allura . app . SitemapEntry ` list suitable for rendering the project navbar with tools grouped together by tool type .
def grouped_navbar_entries(self):
        sitemap = self.sitemap()
        grouped_nav = OrderedDict()
        counts = Counter([e.tool_name.lower() for e in sitemap if e.tool_name])
        grouping_threshold = self.get_tool_data(
            'allura', 'grouping_threshold', 1)
        for e in sitemap:
            if not e.tool_name:
                grouped_nav[id(e)] = e
                continue
            tool_name = e.tool_name.lower()
            if counts.get(tool_name, 1) <= grouping_threshold:
                grouped_nav[id(e)] = e
            else:
                if tool_name not in grouped_nav:
                    child = deepcopy(e)
                    e.label = g.entry_points['tool'][
                        tool_name].tool_label + u' \u25be'
                    e.matching_urls.append(e.url)
                    e.url = self.url() + '_list/' + tool_name
                    e.children.append(child)
                    grouped_nav[tool_name] = e
                else:
                    grouped_nav[tool_name].matching_urls.append(e.url)
                    if len(grouped_nav[tool_name].children) < SITEMAP_PER_TOOL_LIMIT - 1:
                        grouped_nav[tool_name].children.append(e)
                    elif len(grouped_nav[tool_name].children) == SITEMAP_PER_TOOL_LIMIT - 1:
                        e.url = self.url() + '_list/' + tool_name
                        e.label = 'More...'
                        grouped_nav[tool_name].children.append(e)
        return grouped_nav.values()
def grouped_navbar_entries ( self ) : sitemap = self . sitemap ( ) grouped_nav = OrderedDict ( ) counts = Counter ( [ e . tool_name . lower ( ) for e in sitemap if e . tool_name ] ) grouping_threshold = self . get_tool_data ( 'allura' , 'grouping_threshold' , 1 ) for e in sitemap : if not e . tool_name : grouped_nav [ id ( e ) ] = e continue tool_name = e . tool_name . lower ( ) if counts . get ( tool_name , 1 ) <= grouping_threshold : grouped_nav [ id ( e ) ] = e else : if tool_name not in grouped_nav : child = deepcopy ( e ) e . label = g . entry_points [ 'tool' ] [ tool_name ] . tool_label + u' \u25be' e . matching_urls . append ( e . url ) e . url = self . url ( ) + '_list/' + tool_name e . children . append ( child ) grouped_nav [ tool_name ] = e else : grouped_nav [ tool_name ] . matching_urls . append ( e . url ) if len ( grouped_nav [ tool_name ] . children ) < SITEMAP_PER_TOOL_LIMIT - 1 : grouped_nav [ tool_name ] . children . append ( e ) elif len ( grouped_nav [ tool_name ] . children ) == SITEMAP_PER_TOOL_LIMIT - 1 : e . url = self . url ( ) + '_list/' + tool_name e . label = 'More...' grouped_nav [ tool_name ] . children . append ( e ) return grouped_nav . values ( )
Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
the project navbar with tools grouped together by tool type.
Return a : class : ` ~allura . app . SitemapEntry ` list suitable for rendering the project navbar with tools grouped together by tool type .
"""Return a :class:`~allura.app.SitemapEntry` list suitable for rendering
        the project navbar with tools grouped together by tool type.
        """ # get orginal (non-grouped) navbar entries # ordered dict to preserve the orginal ordering of tools # count how many tools of each type we have # if it's not a tool, add to navbar and continue # don't need grouping, so just add it directly # tool of a type we don't have in the navbar yet # change label to be the tool name (type) # add tool url to list of urls that will match this nav entry # have to do this before changing the url to the list page # change url to point to tool list page # add tool url to list of urls that will match this nav # entry
self