コード例 #1
0
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)
    )
コード例 #2
0
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))
コード例 #3
0
def progress_factory(style, active, *bars):
    ''' Returns the HTML code for a progress bar based on the style and width
    provided. Multiple bars can be included, see bar_factory() and info_bar(),
    warning_bar(), success_bar(), etc. for child elements. '''

    return classed_div(
        [PROGRESS_CLASS] + style if style else [] + [ACTIVE_CLASS] if active else [],
        *bars
    )
コード例 #4
0
def bar_factory(style, width):
    ''' Returns the HTML code for a section within a progress bar based on the
    style and width provided. Width must be a float between 0 and 1, this makes
    no guarantees as to the total width of all bar elements within a progress
    bar, so make sure your math adds up! '''

    return classed_div([BAR_CLASS] + style if style else [],
        {"style": "width: %%" % width},
        ""
    )
コード例 #5
0
ファイル: alerts.py プロジェクト: cnvandev/zwitscher-maschine
def alert_factory(is_long, title, *content):
    ''' Returns the HTML code for a generic alert message. Really only to be
    used internally, use alert() or long_alert()

    '''

    return classed_div(ALERT_CLASS, *content,
        prepend=[classed_button(CLOSE_CLASS,
            {
                "type": BUTTON_CLASS,
                "data-dismiss": ALERT_CLASS
            },
            "x"
        ),
        strong(title) if is_long else h4(title)],
    )
コード例 #6
0
def alert_factory(is_long, title, *content):
    ''' Returns the HTML code for a generic alert message. Really only to be
    used internally, use alert() or long_alert()

    '''

    return classed_div(
        ALERT_CLASS,
        *content,
        prepend=[
            classed_button(CLOSE_CLASS, {
                "type": BUTTON_CLASS,
                "data-dismiss": ALERT_CLASS
            }, "x"),
            strong(title) if is_long else h4(title)
        ],
    )
コード例 #7
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
        )
    ]
コード例 #8
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def small_well(*content):
    ''' Returns the HTML code for a small well. Like a grey-background
    blockquote. '''

    return classed_div([WELL_CLASS, SMALL_WELL_CLASS], *content)
コード例 #9
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def container(*content):
    ''' Returns the HTML code for a basic div container. '''

    return classed_div(CONTAINER_CLASS, *content)
コード例 #10
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def well(*content):
    ''' Returns the HTML code for a well. Like a grey-background blockquote. '''

    return classed_div(WELL_CLASS, *content)
コード例 #11
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def large_well(*content):
    ''' Returns the HTML code for a large well. Like a grey-background
    blockquote. '''

    return classed_div([WELL_CLASS, LARGE_WELL_CLASS], *content)
コード例 #12
0
def button_group(*content):
    ''' Returns the HTML code for a button group that contains the given
    buttons. '''

    return classed_div(BUTTON_GROUP_CLASS, *content)
コード例 #13
0
def button_toolbar(*content):
    ''' Returns the HTML code for a toolbar that contains the given buttons. '''

    return classed_div(BUTTON_TOOLBAR_CLASS, *content)
コード例 #14
0
ファイル: nav.py プロジェクト: cnvandev/zwitscher-maschine
def tab_pane(tab_id, *content):
    ''' Returns a single content pane for tab navigation. '''
    
    return classed_div(TAB_PANE_CLASS, ID(tab_id), *content))
コード例 #15
0
def pagination(*content):
    ''' Returns the HTML for a pagination element. Fill with an unordered list
    (I know, right? Unordered?) to display properly. '''

    return classed_div(PAGINATION_CLASS, *content)
コード例 #16
0
def pagination(*content):
    ''' Returns the HTML for a pagination element. Fill with an unordered list
    (I know, right? Unordered?) to display properly. '''
    
    return classed_div(PAGINATION_CLASS, *content)
コード例 #17
0
ファイル: nav.py プロジェクト: cnvandev/zwitscher-maschine
def tab_container(*content):
    ''' Returns a container for tab-pane elements. '''

    return classed_div(TAB_CONTENT_CLASS, *content)
コード例 #18
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def small_well(*content):
    ''' Returns the HTML code for a small well. Like a grey-background
    blockquote. '''

    return classed_div([WELL_CLASS, SMALL_WELL_CLASS], *content)
コード例 #19
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def container(*content):
    ''' Returns the HTML code for a basic div container. '''

    return classed_div(CONTAINER_CLASS, *content)
コード例 #20
0
def hero_unit(*content):
    ''' Returns the HTML code for a 'Hero Unit', like a big marketing banner on
    a front page. '''

    return classed_div(HERO_UNIT_CLASS, *elements)
コード例 #21
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def well(*content):
    ''' Returns the HTML code for a well. Like a grey-background blockquote. '''

    return classed_div(WELL_CLASS, *content)
コード例 #22
0
ファイル: misc.py プロジェクト: cnvandev/zwitscher-maschine
def large_well(*content):
    ''' Returns the HTML code for a large well. Like a grey-background
    blockquote. '''

    return classed_div([WELL_CLASS, LARGE_WELL_CLASS], *content)
コード例 #23
0
ファイル: nav.py プロジェクト: cnvandev/zwitscher-maschine
def tab_navigation(*content):
    ''' Returns the HTML code for a tab navigation container using the supplied
    tabs and container (see tabs() and tab_container()). '''
    
    return classed_div(TABBABLE_CLASS, *content)
コード例 #24
0
def page_header(title, subtitle):
    ''' Returns the HTML for a page header or title, with a subtitle. '''
    
    return classed_div(PAGE_HEADER_CLASS,
        h1(title, small(subtitle)
    )