1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| {% import ( "fmt"
"{{{ .Package }}}/app" "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/app/util" ) %}
{% func SVG(k string) %}{%s= util.SVGLibrary[k] %}{% endfunc %}
{% func SVGRef(k string, w int, h int, cls string, ps *cutil.PageState) %}{% stripspace %} {% if k != "" %} {% code ps.AddIcon(k) if w == 0 { w = 20 } if h == 0 { h = 20 } style := fmt.Sprintf("width: %dpx; height: %dpx;", w, h) %} {% if cls == "" %} <svg style="{%s style %}"><use xlink:href="#svg-{%s k %}" /></svg> {% else %} <svg class="{%s cls %}" style="{%s style %}"><use xlink:href="#svg-{%s k %}" /></svg> {% endif %} {% endif %} {% endstripspace %}{% endfunc %}
{% func SVGRefIcon(k string, ps *cutil.PageState) %}{% stripspace %} {%= SVGRef(k, 20, 20, "icon", ps) %} {% endstripspace %}{% endfunc %}
{%- func IconGallery(as *app.State, ps *cutil.PageState) -%} <div class="flex-wrap mt"> {%- for _, k := range util.SVGIconKeys -%} <div class="icon-gallery-icon"> <div class="gallery-svg">{%= SVGRef(k, 64, 64, "icon", ps) %}</div> <div class="gallery-title">{%s k %}</div> </div> {%- endfor -%} </div> {%- endfunc -%}
|