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)
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)
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 ) ]
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)
def thumbnails(*content): ''' Returns the HTML code for a container for thumbnail elements. ''' return classed_ul(THUMBNAILS_CLASS, *content)
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)
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)