Core

/views/components/edit/String.html (4.4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{% import (
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/views/components"
) %}

{% func String(key string, id string, value string, placeholder ...string) %}{% stripspace %}
{% if id == "" %}
<input name="{%s key %}" value="{%s value %}"{%= components.PlaceholderFor(placeholder) %} />
{% else %}
<input id="{%s id %}" name="{%s key %}" value="{%s value %}"{%= components.PlaceholderFor(placeholder) %} />
{% endif %}
{% endstripspace %}{% endfunc %}

{% func StringVertical(key string, id string, title string, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<div class="mb expanded">
{%= components.Indent(true, indent + 1) %}
<label for="{%s id %}"><em class="title">{%s title %}</em></label>
{%= components.Indent(true, indent + 1) %}
<div class="mt">{%= String(key, id, value, help...) %}</div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func StringTable(key string, id string, title string, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<tr>
{%= components.Indent(true, indent + 1) %}
<th class="shrink"><label for="{%s id %}"{%= components.TitleFor(help) %}>{%s title %}</label></th>
{%= components.Indent(true, indent + 1) %}
<td>{%= String(key, id, value, help...) %}</td>
{%= components.Indent(true, indent) %}
</tr>
{% endstripspace %}{% endfunc %}

{% func Password(key string, id string, value string, placeholder ...string) %}{% stripspace %}
{% if id == "" %}
<input name="{%s key %}" type="password" value="{%s value %}"{%= components.PlaceholderFor(placeholder) %} />
{% else %}
<input id="{%s id %}" name="{%s key %}" type="password" value="{%s value %}"{%= components.PlaceholderFor(placeholder) %} />
{% endif %}
{% endstripspace %}{% endfunc %}

{% func PasswordVertical(key string, id string, title string, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<div class="mb expanded">
{%= components.Indent(true, indent + 1) %}
<label for="{%s id %}"><em class="title">{%s title %}</em></label>
{%= components.Indent(true, indent + 1) %}
<div class="mt">{%= Password(key, id, value, help...) %}</div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func PasswordTable(key string, id string, title string, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<tr>
{%= components.Indent(true, indent + 1) %}
<th class="shrink"><label for="{%s id %}"{%= components.TitleFor(help) %}>{%s title %}</label></th>
{%= components.Indent(true, indent + 1) %}
<td>{%= Password(key, id, value, help...) %}</td>
{%= components.Indent(true, indent) %}
</tr>
{% endstripspace %}{% endfunc %}

{% func Textarea(key string, id string, rows int, value string, placeholder ...string) %}{% stripspace %}
{% if id == "" %}
<textarea rows="{%d rows %}" name="{%s key %}"{%= components.PlaceholderFor(placeholder) %}>{%s value %}</textarea>
{% else %}
<textarea rows="{%d rows %}" id="{%s id %}" name="{%s key %}"{%= components.PlaceholderFor(placeholder) %}>{%s value %}</textarea>
{% endif %}
{% endstripspace %}{% endfunc %}

{% func TextareaVertical(key string, id string, title string, rows int, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<div class="mb expanded">
{%= components.Indent(true, indent + 1) %}
<label for="{%s id %}"><em class="title">{%s title %}</em></label>
{%= components.Indent(true, indent + 1) %}
<div class="mt">{%= Textarea(key, id, rows, value, help...) %}</div>
{%= components.Indent(true, indent) %}
</div>
{% endstripspace %}{% endfunc %}

{% func TextareaTable(key string, id string, title string, rows int, value string, indent int, help ...string) %}{% stripspace %}
{%- code id = cutil.CleanID(key, id) -%}
<tr>
{%= components.Indent(true, indent + 1) %}
<th class="shrink"><label for="{%s id %}"{%= components.TitleFor(help) %}>{%s title %}</label></th>
{%= components.Indent(true, indent + 1) %}
<td>{%= Textarea(key, id, rows, value, help...) %}</td>
{%= components.Indent(true, indent) %}
</tr>
{% endstripspace %}{% endfunc %}