How to use the clld.web.util.htmllib.HTML function in clld

To help you get started, we’ve selected a few clld examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clld / glottolog3 / glottolog3 / langdocstatus.py View on Github external
def get_legends(self):
        def img(spec):
            return HTML.img(
                src=svg.data_url(svg.icon(spec)), height='20', width='20', style='margin-left: 0.5em;')

        def desc(text):
            return HTML.span(text, style='margin-left: 0.5em; margin-right: 0.5em;')

        values = [desc('Most extensive description is a ...')]
        for sdt in get_parameter('med').domain:
            icon = self.de_to_icon['med'][sdt.id.split('-')[1]]
            values.append(
                HTML.label(
                    HTML.input(
                        type='checkbox',
                        checked='checked',
                        id='marker-toggle-sdt-' + str(sdt.number),
                        onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'),
                    img(icon.shape + 'ffffff' if self.focus == 'ed' else 'c' + icon.color),
                    desc(sdt.name)))
        values.append(desc('Language is ...'))
        for ed in get_parameter('aes').domain:
            icon = self.de_to_icon['aes'][ed.id.split('-')[1]]
            values.append((
                HTML.label(
                    HTML.input(
                        type='checkbox',
                        checked='checked',
                        id='marker-toggle-ed-' + str(ed.number),
                        onclick='GLOTTOLOG3.LangdocStatus.toggleMarkers()'),
github clld / glottolog3 / glottolog3 / datatables.py View on Github external
def __init__(self, dt, name, **kw):
        ma = DBSession.query(Parameter).filter(Parameter.id == 'macroarea').one()
        kw['choices'] = [de.name for de in ma.domain]
        kw['bSortable'] = False
        kw['sDescription'] = HTML.span(
            'see ',
            HTML.a('glossary',
                   href=dt.req.route_url('home.glossary', _anchor='macroarea')))
        super(MacroareaCol, self).__init__(dt, name, **kw)
github clld / clld / src / clld / web / util / helpers.py View on Github external
def td(icon):
        return HTML.td(
            marker_img(icon.url(req)),
            onclick='CLLD.reload({"%s": "%s"})' % (param, icon.name))
    rows = [
github clld / clld / src / clld / web / datatables / base.py View on Github external
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)
github clld / clld / src / clld / web / datatables / base.py View on Github external
def doc(self):
        items = []
        for col in self.ctx.cols:
            dsc = col.js_args.get('sDescription')
            if dsc:
                items.extend([HTML.dt(col.js_args['sTitle']), HTML.dd(dsc)])
        return HTML.dl(
            HTML.p(
                'Columns containing numeric data may be filtered giving upper or lower '
                'bounds in the form "<5" or ranges in the form "-2..20".'),
            self.ctx.options.get('sDescription', ''),
            *items)
github clld / clld / src / clld / web / datatables / base.py View on Github external
def doc(self):
        items = []
        for col in self.ctx.cols:
            dsc = col.js_args.get('sDescription')
            if dsc:
                items.extend([HTML.dt(col.js_args['sTitle']), HTML.dd(dsc)])
        return HTML.dl(
            HTML.p(
                'Columns containing numeric data may be filtered giving upper or lower '
                'bounds in the form "<5" or ranges in the form "-2..20".'),
            self.ctx.options.get('sDescription', ''),
            *items)
github clld / clld / src / clld / db / models / source.py View on Github external
def coins(self, req):
        return HTML.span(
            ' ',
            **coins.ContextObject.from_bibtex(
                req.dataset.name, self.bibtex()).span_attrs()
        )