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
| {% import ( "{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/views/components" ) %}
{% func Int(key string, id string, value any, placeholder ...string) %}{% stripspace %} {% if id == "" %} <input name="{%s key %}" type="number" value="{%v value %}"{%= components.PlaceholderFor(placeholder) %} /> {% else %} <input id="{%s id %}" name="{%s key %}" type="number" value="{%v value %}"{%= components.PlaceholderFor(placeholder) %} /> {% endif %} {% endstripspace %}{% endfunc %}
{% func IntVertical(key string, id string, title string, value int, 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">{%= Int(key, id, value, help...) %}</div> {%= components.Indent(true, indent) %} </div> {% endstripspace %}{% endfunc %}
{% func IntTable(key string, id string, title string, value int, 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>{%= Int(key, id, value, help...) %}</td> {%= components.Indent(true, indent) %} </tr> {% endstripspace %}{% endfunc %}
|