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
| {% import ( "github.com/google/uuid"
"{{{ .Package }}}/app/controller/cutil" "{{{ .Package }}}/views/components" ) %}
{% func UUID(key string, id string, value *uuid.UUID, placeholder ...string) %}{% stripspace %} {%- code var v string if value != nil { v = value.String() } -%} {%= String(key, id, v, placeholder...) %} {% endstripspace %}{% endfunc %}
{% func UUIDVertical(key string, id string, title string, value *uuid.UUID, 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">{%= UUID(key, id, value, help...) %}</div> {%= components.Indent(true, indent) %} </div> {% endstripspace %}{% endfunc %}
{% func UUIDTable(key string, id string, title string, value *uuid.UUID, 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>{%= UUID(key, id, value, help...) %}</td> {%= components.Indent(true, indent) %} </tr> {% endstripspace %}{% endfunc %}
|