def toolbar(self): """ """ return HTML.div( button( icon('info-sign', inverted=True), class_='btn-info %s-cdOpener' % self.eid), HTML.a( icon('download-alt'), HTML.span(class_="caret"), **{ 'class_': "btn dropdown-toggle", 'data-toggle': "dropdown", 'href': "#", 'id': "dt-dl-opener", } ), HTML.ul( #HTML.li(HTML.a('csv', href="#")), *[HTML.li(HTML.a( fmt, href="#", onclick="document.location.href = CLLD.DataTable.current_url" "('%s', '%s'); return false;" % (self.eid, fmt), id='dt-dl-%s' % fmt)) for fmt in [a.extension for n, a in self.req.registry.getAdapters([self.model()], IIndex)] if fmt != 'html'], **dict(class_="dropdown-menu")), class_='btn-group right')
def format(self, item): return button( self.button_text, href=self.dt.req.resource_url(self.get_obj(item), ext='snippet.html'), title="show details", class_="btn-info details", tag=HTML.button)
def comment_button(req, feature, language, class_=''): return HTML.form( button(icon('comment'), type='submit', class_=class_, title='comment'), class_='inline', method='POST', action=req.route_url('datapoint', fid=feature.id, lid=language.id), )
def toolbar(self): """ """ return HTML.div( button(icon('info-sign', inverted=True), class_='btn-info %s-cdOpener' % self.eid), HTML.a( icon('download-alt'), HTML.span(class_="caret"), **{ 'class_': "btn dropdown-toggle", 'data-toggle': "dropdown", 'href': "#", 'id': "dt-dl-opener", }), HTML.ul( #HTML.li(HTML.a('csv', href="#")), *[ HTML.li( HTML. a(fmt, href="#", onclick= "document.location.href = CLLD.DataTable.current_url" "('%s', '%s'); return false;" % (self.eid, fmt), id='dt-dl-%s' % fmt)) for fmt in [ a.extension for n, a in self.req.registry.getAdapters( [self.model()], IIndex) ] if fmt != 'html' ], **dict(class_="dropdown-menu")), class_='btn-group right')
def format(self, item): return button(self.button_text, href=self.dt.req.resource_url(self.get_obj(item), ext='snippet.html'), title="show details", class_="btn-info details", tag=HTML.button)
def format(self, item): return button( #icon('info-sign', inverted=True), 'more', href=self.dt.req.resource_url(item, ext='snippet.html'), title="show details", class_="btn-info details", tag=HTML.button)
def comment_button(req, valueset, class_=''): return HTML.form(button(icon('comment'), type='submit', class_=class_, title='comment'), class_='inline', method='POST', action=req.resource_url(valueset))
def infobutton(desc, content_type='text', placement='right'): if not desc: return '' if content_type == 'text': desc = text2html(escape(desc, quote=True), mode='p') return button( icon('info-sign', inverted=True), **{ 'data-toggle': 'popover', 'data-placement': placement, 'data-content': desc, 'class': ['btn-info', 'btn-mini', 'fieldinfo'] })
def infobutton(desc, content_type='text', placement='right'): if not desc: return '' if content_type == 'text': desc = text2html(escape(desc, quote=True), mode='p') return button( icon('info-sign', inverted=True), **{ 'data-toggle': 'popover', 'data-placement': placement, 'data-content': desc, 'class': ['btn-info', 'btn-mini', 'fieldinfo']})
def icons(req, param): icon_map = req.registry.settings['icons'] print "yes" print icon_map td = lambda spec: HTML.td( HTML.img( src=req.static_url('clld:web/static/icons/' + icon_map[spec] + '.png'), ##src=req.static_url('lsi:static/icons/' + icon_map[spec] + '.png'), height='20', width='20'), onclick='LSI.reload({"%s": "%s"})' % (param, spec)) rows = [ HTML.tr(*map(td, icons)) for c, icons in groupby(sorted(icon_map.keys()), lambda spec: spec[0]) ] return HTML.div( HTML.table(HTML.tbody(*rows), class_="table table-condensed"), button('Close', **{'data-dismiss': 'clickover'}))
def format(self, item): return button( icon('globe'), href="#map", onclick='TSAMMALEX.highlightEcoregion(CLLD.Maps.map.marker_map.' + item.id + ')')
def test_button(self): from clld.web.util.helpers import button self.assertTrue('click' in button('click'))
def github_link(ctx): return button( icon('pencil'), title="see on GitHub", href=ctx.github_url, class_='btn-mini')
def github_link(ctx): return button(icon('pencil'), title="see on GitHub", href=ctx.github_url, class_='btn-mini')
def test_button(env): from clld.web.util.helpers import button assert 'click' in button('click')
def test_button(self): from clld.web.util.helpers import button self.assertTrue("click" in button("click"))