Mercurial > libervia-web
comparison libervia/web/pages/_browser/template.py @ 1538:8d61654cb34f
browser (template): fix `icon_use` when no class is specified
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 28 Jun 2023 10:05:16 +0200 |
parents | 285c49d7aad3 |
children | 9865013da86c |
comparison
equal
deleted
inserted
replaced
1537:c2569408fa35 | 1538:8d61654cb34f |
---|---|
147 | 147 |
148 env.addFilter("media_type_sub", _media_type_sub) | 148 env.addFilter("media_type_sub", _media_type_sub) |
149 | 149 |
150 | 150 |
151 def _icon_use(name, cls=""): | 151 def _icon_use(name, cls=""): |
152 kwargs = cls.to_dict() | 152 if cls: |
153 cls = kwargs.get('cls') | 153 kwargs = cls.to_dict() |
154 cls = kwargs.get('cls') | |
154 return safe( | 155 return safe( |
155 '<svg class="svg-icon{cls}" xmlns="http://www.w3.org/2000/svg" ' | 156 '<svg class="svg-icon{cls}" xmlns="http://www.w3.org/2000/svg" ' |
156 'viewBox="0 0 100 100">\n' | 157 'viewBox="0 0 100 100">\n' |
157 ' <use href="#{name}"/>' | 158 ' <use href="#{name}"/>' |
158 '</svg>\n'.format(name=name, cls=(" " + cls) if cls else "") | 159 '</svg>\n'.format(name=name, cls=(" " + cls) if cls else "") |