Core

/views/components/edit/Icon.html (2.2 KB)

 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{% import (
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
) %}

{% func IconPicker(key string, selected string, ps *cutil.PageState, indent int) %}{% stripspace %}
{%= components.Indent(true, indent) %}
<div class="choice">
{% for _, k := range util.SVGIconKeys %}
{%= components.Indent(true, indent + 1) %}
<label title="{%s k %}">
{% if k == selected %}
<input type="radio" name="{%s key %}" value="{%s k %}" checked="checked" />
{% else %}
<input type="radio" name="{%s key %}" value="{%s k %}" />
{% endif %}
{% space %}
{%= components.SVGRef(k, 48, 48, "", ps) %}
</label>
{% endfor %}
{%= components.Indent(true, indent + 1) %}
<div class="clear"></div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func IconPickerVertical(key string, title string, value string, ps *cutil.PageState, indent int) %}{% stripspace %}
<div class="mb expanded">
{%= components.Indent(true, indent + 1) %}
<em class="title">{%s title %}</em>
{%= components.Indent(true, indent + 1) %}
<div class="mt">{%= IconPicker(key, value, ps, indent) %}</div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func Icons(key string, title string, value string, ps *cutil.PageState, indent int) %}{% stripspace %}
<div class="mb expanded">
{%= components.Indent(true, indent + 1) %}
<em class="title">{%s title %}</em>
{%= components.Indent(true, indent + 1) %}
<div class="mt">{%= IconPicker(key, value, ps, indent) %}</div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func IconsTable(key string, title string, value string, ps *cutil.PageState, indent int, help ...string) %}{% stripspace %}
<tr>
{%= components.Indent(true, indent + 1) %}
<th class="shrink"><label>{%s title %}</label></th>
{%= components.Indent(true, indent + 1) %}
<td>{%= Icons(key, title, value, ps, indent + 2) %}
</td>
{%= components.Indent(true, indent) %}
</tr>
{% endstripspace %}{% endfunc %}