コード例 #1
0
def nav_group(*content):
    ''' A group of navigation elements for use in a navbar. Children should be
    element()s (see nav.py's element() function.)

    '''

    return classed_ul(NAV_CLASS, *content)
コード例 #2
0
def dropdown_menu(*items):
    ''' Returns the HTML code for a dropdown menu containing the given
    menu items. '''

    return classed_ul(MENU_CLASS, {
        "role": "menu",
        "aria-labelledBy": "dropdownMenu",
    }, *items)
コード例 #3
0
ファイル: media.py プロジェクト: cnvandev/zwitscher-maschine
def media(img_url, title, link_url, *content):
    ''' Returns the HTML for a basic formatter for a "media object" like a video
    or something. It kind of looks like a Facebook post. '''

    return classed_div(MEDIA_CLASS,
        *media_content(img_url, title, link_url, *content
    )


def media_list(*content):
    ''' A list that handles media items (even nested!) gracefully. Use
    media_list_item to generate them. '''

    return classed_ul(MEDIA_LIST_CLASS, *content)


def media_list_item(img_url, title, link_url, *content):
    ''' A single list item in a media list (see media_list() for something that
    is designed to gracefully hold them). '''

    return classed_li(MEDIA_CLASS,
        *media_content(img_url, title, link_url, *content)
    )


def media_content(img_url, title, link_url, *content):
    ''' Returns the content to a media block. Should only be used internally,
    use media() or media_list() + media_list_item(). '''

    return [
        classed_a(PULL_LEFT, href(link_url),
            img({"src": img_url, "class": MEDIA_OBJECT_CLASS})
        ),
        classed_div(MEDIA_BODY_CLASS,
            h4(classes(MEDIA_HEADING_CLASS), title),
            *content
        )
    ]
コード例 #4
0
def breadcrumbs(*content):
    ''' Returns the HTML code for a breadcrumb listing. Fill with crumb() and
    divider() elements (see below in this class.) '''

    return classed_ul(BREADCRUMBS_CLASS, *content)
コード例 #5
0
def thumbnails(*content):
    ''' Returns the HTML code for a container for thumbnail elements. '''

    return classed_ul(THUMBNAILS_CLASS, *content)
コード例 #6
0
def dropdown_menu(*items):
    """ Returns the HTML code for a dropdown menu containing the given
    menu items. """

    return classed_ul(MENU_CLASS, {"role": "menu", "aria-labelledBy": "dropdownMenu"}, *items)
コード例 #7
0
ファイル: nav.py プロジェクト: cnvandev/zwitscher-maschine
def generic_nav(*content):
    ''' Returns the HTML code for a set of tab navigaiton elements using the set
    of given tabs. '''

    return classed_ul([NAV_CLASS, NAV_TABS_CLASS], *content)
コード例 #8
0
def breadcrumbs(*content):
    ''' Returns the HTML code for a breadcrumb listing. Fill with crumb() and
    divider() elements (see below in this class.) '''

    return classed_ul(BREADCRUMBS_CLASS, *content)
コード例 #9
0
def thumbnails(*content):
    ''' Returns the HTML code for a container for thumbnail elements. '''

    return classed_ul(THUMBNAILS_CLASS, *content)