def thumbnail(span, *content): ''' Returns the HTML code for a single thumbnail element that can contain any HTML. Can contain one or multiple elements if needed. ''' return classed_li(SPAN_CLASS + span, *([classed_div(THUMBNAIL_CLASS, *content)] if len(elements) > 1 else content) )
def thumbnail(span, *content): ''' Returns the HTML code for a single thumbnail element that can contain any HTML. Can contain one or multiple elements if needed. ''' return classed_li( SPAN_CLASS + span, *([classed_div(THUMBNAIL_CLASS, *content)] if len(elements) > 1 else content))
def submenu(text, url, *items): ''' Returns the HTML code for a submenu in a dropdown menu. The submenu can contain its own items just like a regular menu. ''' return classed_li( SUBMENU_CLASS, items, prepend=[a(untabbable(), text, href=url), dropdown_menu(*items)])
def nav_dropdown(title, *content): ''' A button to open a dropdown menu in a navbar. Give it a menu in the content for it to actually work. WARNING: Unlike other functions, this one can't take extra classes right now :( ''' return classed_li(DROPDOWN_CLASS, classed_a( combine(DROPDOWN_CLASS, "toggle"), toggle(DROPDOWN_CLASS), title, classed_b("caret"), *content ) )
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 nav_divider(): ''' A vertical divider for navigation bars. ''' return classed_li(DIVIDER_CLASS, *content)
def submenu(text, url, *items): """ Returns the HTML code for a submenu in a dropdown menu. The submenu can contain its own items just like a regular menu. """ return classed_li(SUBMENU_CLASS, items, prepend=[a(untabbable(), text, href=url), dropdown_menu(*items)])
def nav_header(*content): """ A header in a navigation list. """ return classed_li(NAV_HEADER_CLASS, *content)
def divider(*content): """ Returns the HTML code for divider in a dropdown menu. """ return classed_li(DIVIDER_CLASS, *content)
def menu_item(*content): """ Returns the HTML code for a menu item in a dropdown menu. """ return classed_li(*content)
def nav_header(*content): ''' A header in a navigation list. ''' return classed_li(NAV_HEADER_CLASS, *content)
def divider(*content): ''' Returns the HTML code for divider in a dropdown menu. ''' return classed_li(DIVIDER_CLASS, *content)
def menu_item(*content): ''' Returns the HTML code for a menu item in a dropdown menu. ''' return classed_li(*content)