Core

/views/components/edit/File.html (1.6 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
{% import "{{{ .Package }}}/views/components" %}

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

{% func FileTable(key string, id string, title string, label string, value string) %}{% stripspace %}
<tr>
<th class="shrink"><label for="{%s id %}">{%s title %}</label></th>
<td>
{%= File(key, id, label, value) %}
</td>
</tr>
{% endstripspace %}{% endfunc %}

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

{% func FileMultipleTable(key string, id string, title string, label string, value string) %}{% stripspace %}
<tr>
<th class="shrink"><label for="{%s id %}">{%s title %}</label></th>
<td>
{%= FileMultiple(key, id, label, value) %}
</td>
</tr>
{% endstripspace %}{% endfunc %}