Пример #1
0
def format_external_link_in_label(url, label=None):
    label = label or URL(url).domain()
    return HTML.span(HTML.a(HTML.i('', class_="icon-share icon-white"),
                            label,
                            href=url,
                            style="color: white"),
                     class_="label label-info")
Пример #2
0
def format_external_link_in_label(url, label=None):
    label = label or URL(url).domain()
    return HTML.span(
        HTML.a(
            HTML.i('', class_="icon-share icon-white"),
            label,
            href=url,
            style="color: white"),
        class_="label label-info")
Пример #3
0
    def render(self, no_js=False):
        adapters = [
            a for n, a in self.req.registry.getAdapters([self.obj],
                                                        self.interface)
            if a.extension not in set(self.options['exclude'])
        ]
        adoc = []
        for adapter in adapters:
            if adapter.__doc__:
                adoc.append(HTML.dt(adapter.name or adapter.extension))
                adoc.append(HTML.dd(adapter.__doc__))
        doc = HTML.div(
            HTML.p(
                """You may download alternative representations of the data on
"%s" by clicking the button """ % self.ctx,
                HTML.i(class_='icon-download-alt')), self.doc(),
            HTML.dl(*adoc))
        res = HTML.div(
            HTML.button(HTML.i(class_='icon-info-sign icon-white'),
                        class_='btn btn-info %s' % self._opener_class,
                        **{
                            'data-content': text_type(doc),
                            'type': 'button'
                        }),
            HTML.a(
                HTML.i(class_='icon-download-alt'), HTML.span(class_="caret"),
                **{
                    'class_': "btn dropdown-toggle",
                    'data-toggle': "dropdown",
                    'href': "#",
                    'id': self._id_prefix + "opener"
                }),
            HTML.ul(*[HTML.li(self.dl_link(adapter)) for adapter in adapters],
                    **dict(class_="dropdown-menu")),
            class_='btn-group right')
        if no_js:
            return res
        return HTML.div(res, self.js())
Пример #4
0
    def render(self, no_js=False):
        adapters = [a for n, a in
                    self.req.registry.getAdapters([self.obj], self.interface)
                    if a.extension not in set(self.options['exclude'])]
        adapters = sorted(adapters, key=lambda x: x.extension)
        adoc = []
        for adapter in adapters:
            if adapter.__doc__:
                adoc.append(HTML.dt(adapter.name or adapter.extension))
                adoc.append(HTML.dd(adapter.__doc__))
        doc = HTML.div(
            HTML.p(
                """You may download alternative representations of the data on
"%s" by clicking the button """ % self.ctx,
                HTML.i(class_='icon-download-alt')),
            self.doc(),
            HTML.dl(*adoc))
        res = HTML.div(
            HTML.button(
                HTML.i(class_='icon-info-sign icon-white'),
                class_='btn btn-info %s' % self._opener_class,
                **{'data-content': text_type(doc), 'type': 'button'}),
            HTML.a(
                HTML.i(class_='icon-download-alt'),
                HTML.span(class_="caret"),
                **{
                    'class_': "btn dropdown-toggle",
                    'data-toggle': "dropdown",
                    'href': "#",
                    'id': self._id_prefix + "opener"}),
            HTML.ul(
                *[HTML.li(self.dl_link(adapter)) for adapter in adapters],
                **dict(class_="dropdown-menu")),
            class_='btn-group right')
        if no_js:
            return res
        return HTML.div(res, self.js())
Пример #5
0
def icon(class_, inverted=False, **kw):
    if not class_.startswith('icon-'):
        class_ = 'icon-' + class_
    if inverted:
        class_ = '%s icon-white' % class_
    return HTML.i(class_=class_, **kw)
Пример #6
0
 def get_attrs(self, item):
     item = self.get_obj(item)
     form = util.form(item.name)
     if item.variant:
         form = HTML.i(form)
     return {'label': HTML.span(form, ' ', HTML.sup(item.disambiguation))}
Пример #7
0
def icon(class_, inverted=False, **kw):
    if not class_.startswith('icon-'):
        class_ = 'icon-' + class_
    if inverted:
        class_ = '%s icon-white' % class_
    return HTML.i(class_=class_, **kw)
Пример #8
0
def icon(class_, inverted=False, **kw):
    if not class_.startswith("icon-"):
        class_ = "icon-" + class_
    if inverted:
        class_ = "%s icon-white" % class_
    return HTML.i(class_=class_, **kw)
Пример #9
0
 def format_name(n):
     res = [HTML.i(n.name)]
     if n.ipa:
         res.append(' [%s]' % n.ipa)
     return HTML.span(*res)
Пример #10
0
 def format_name(n):
     res = [HTML.i(n.name)]
     if n.ipa:
         res.append(' [%s]' % n.ipa)
     return HTML.span(*res)