source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/applications/admin/models/buttons.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 1.2 KB
Line 
1# Template helpers
2
3import os
4
5
6def A_button(*a, **b):
7    b['_data-role'] = 'button'
8    b['_data-inline'] = 'true'
9    return A(*a, **b)
10
11def button(href, label):
12    if is_mobile:
13        ret = A_button(SPAN(label), _href=href)
14    else:
15        ret = A(SPAN(label), _class='button btn', _href=href)
16    return ret
17
18def button_enable(href, app):
19    if os.path.exists(os.path.join(apath(app, r=request), 'DISABLED')):
20        label = SPAN(T('Enable'), _style='color:red')
21    else:
22        label = SPAN(T('Disable'), _style='color:green')
23    id = 'enable_' + app
24    return A(label, _class='button btn', _id=id, callback=href, target=id)
25
26def sp_button(href, label):
27    if request.user_agent().get('is_mobile'):
28        ret = A_button(SPAN(label), _href=href)
29    else:
30        ret = A(SPAN(label), _class='button special btn btn-inverse', _href=href)
31    return ret
32
33def helpicon():
34    return IMG(_src=URL('static', 'images/help.png'), _alt='help')
35
36def searchbox(elementid):
37    return SPAN(LABEL(IMG(_id="search_start", _src=URL('static', 'images/search.png'), _alt=T('filter')),
38                    _class='icon', _for=elementid), ' ',
39                INPUT(_id=elementid, _type='text', _size=12, _class="input-medium"),
40            _class="searchbox")
Note: See TracBrowser for help on using the repository browser.