Example #1
0
 def render(self, request, block=None, **kwargs):
     instance = request.instance
     tabs = html.tabs().addData('options', {'ajax': True})
     first = True
     for order, elem in sorted(self.get_views(request), key=lambda v: v[0]):
         # we render so that we add javascript if it is needed
         text = elem.view.render()
         link = views.application_link(elem, asbutton=False)
         tabs.addtab(link, text)
     return tabs
Example #2
0
def navstream(request, urlselects, secondary_after, level):
    for request, nav in sorted(((c, c.in_navigation) for c in request.auth_children()), key=lambda x: x[1]):
        if not nav:
            continue
        link = application_link(request, asbutton=False)
        li = Widget("li", link)
        secondary = secondary_after and nav > secondary_after
        if link.attrs["href"] in urlselects:
            li.addClass(classes.state_active)
        if level:
            slis = list(navstream(request, urlselects, None, level - 1))
            if slis:
                ul = Widget("ul")
                for sli, _ in slis:
                    ul.add(sli)
                li.add(ul)
        yield li, secondary
Example #3
0
def navstream(request, urlselects, secondary_after, level):
    for request, nav in sorted(((c, c.in_navigation)\
                for c in request.auth_children()), key=lambda x : x[1]):
        if not nav:
            continue
        link = application_link(request, asbutton=False)
        li = Widget('li', link)
        secondary = secondary_after and nav > secondary_after
        if link.attrs['href'] in urlselects:
            li.addClass(classes.state_active)
        if level:
            slis = list(navstream(request, urlselects, None, level - 1))
            if slis:
                ul = Widget('ul')
                for sli, _ in slis:
                    ul.add(sli)
                li.add(ul)
        yield li, secondary