async def serve(q: Q):
    hash = q.args['#']
    if hash:
        blurb = q.page['blurb']
        if hash == 'menu/spam':
            blurb.content = "Sorry, we're out of spam!"
        elif hash == 'menu/ham':
            blurb.content = "Sorry, we're out of ham!"
        elif hash == 'menu/eggs':
            blurb.content = "Sorry, we're out of eggs!"
        elif hash == 'about':
            blurb.content = 'Everything here is gluten-free!'
    else:
        q.page['nav'] = ui.toolbar_card(
            box='1 1 4 1',
            items=[
                ui.command(name='#menu/spam', label='Spam'),
                ui.command(name='#menu/ham', label='Ham'),
                ui.command(name='#menu/eggs', label='Eggs'),
                ui.command(name='#about', label='About'),
            ],
        )
        q.page['blurb'] = ui.markdown_card(
            box='1 2 4 2',
            title='Store',
            content='Welcome to our store!',
        )
    await q.page.save()
Exemple #2
0
async def serve(q: Q):
    q.page['nav'] = ui.toolbar_card(
        box='1 1 4 1',
        items=[
            ui.command(name='new',
                       label='New',
                       icon='Add',
                       items=[
                           ui.command(name='email',
                                      label='Email Message',
                                      icon='Mail'),
                           ui.command(name='calendar',
                                      label='Calendar Event',
                                      icon='Calendar'),
                       ]),
            ui.command(name='upload', label='Upload', icon='Upload'),
            ui.command(name='share', label='Share', icon='Share'),
            ui.command(name='download', label='Download', icon='Download'),
        ],
        secondary_items=[
            ui.command(name='tile', caption='Grid View', icon='Tiles'),
            ui.command(name='info', caption='Info', icon='Info'),
        ],
        overflow_items=[
            ui.command(name='move', label='Move to...', icon='MoveToFolder'),
            ui.command(name='copy', label='Copy to...', icon='Copy'),
            ui.command(name='rename', label='Rename', icon='Edit'),
        ],
    )
    await q.page.save()
Exemple #3
0
def render_filter_toolbar(q):
    render_home(q)

    q.page["filter_toolbar"] = ui.toolbar_card(
        box=config.boxes["new_filter"],
        items=[
            ui.command(
                name='add_filter',
                label='Add filter',
                caption='Create a new filter',
                icon='Add',
            ),
            ui.command(
                name='reset_filters',
                label='Reset filters',
                caption='Reset the filters',
                icon='Delete',
            )
        ])

    filter_dropdown = populate_dropdown_list(q)

    q.page["filters"] = ui.form_card(box=config.boxes['filters'],
                                     items=filter_dropdown)