Example #1
0
def main_menu_items(request):
    """Returns the main menu."""
    default_app_name = get_default_app_name(request.site, request.user)
    return html.li([
        app.name == default_app_name
        and '<a href="<dz:site_url>/">{}</a>'.format(app.title) or app.link
        for app in get_main_apps(request) if app.visible
    ])
Example #2
0
def main_menu_items(request):
    """Returns the main menu."""
    def style(app):
        return app.name == current_app_name and 'class="active" ' or ''

    default_app_name = get_default_app_name(request.site, request.user)
    current_app_name = request.route and request.route[0] or default_app_name

    return html.li([
        app.name == default_app_name
        and '<a {}href="<dz:site_url>/">{}</a>'.format(style(app), app.title)
        or '<a {}href="<dz:site_url>{}">{}</a>'.format(
            style(app), app.url, app.title) for app in get_main_apps(request)
        if app.visible
    ])
Example #3
0
def system_menu_items(request):
    """Returns the system menu."""
    return html.li([
        app.link for app in get_system_apps(request)
        if app.visible and app.name != request.app.name
    ])