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 ( "fmt"
"{{{ .Package }}}/app/util" ) %}
{% func Bool(key string, id string, x any, nullable bool) %}{% stripspace %} {% code b, isBool := x.(bool) %} {% if isBool && b %} <label class="radiolabel"><input value="{%s util.BoolTrue %}" name="{%s key %}" type="radio" checked="checked" /> {%s util.BoolTrue %}</label> {% else %} <label class="radiolabel"><input value="{%s util.BoolTrue %}" name="{%s key %}" type="radio" /> {%s util.BoolTrue %}</label> {% endif %}
{% if isBool && !b %} <label class="radiolabel"><input value="{%s util.BoolFalse %}" name="{%s key %}" type="radio" checked="checked" /> {%s util.BoolFalse %}</label> {% else %} <label class="radiolabel"><input value="{%s util.BoolFalse %}" name="{%s key %}" type="radio" /> {%s util.BoolFalse %}</label> {% endif %}
{% if nullable %} {% if x == nil %} <label class="radiolabel"><input value="∅" name="{%s key %}" type="radio" checked="checked" /> nil</label> {% else %} <label class="radiolabel"><input value="∅" name="{%s key %}" type="radio" /> nil</label> {% endif %} {% endif %} {% endstripspace %}{% endfunc %}
{% func BoolVertical(key string, title string, value bool, indent int, help ...string) %}{% stripspace %} {%= RadioVertical(key, title, fmt.Sprint(value), []string{util.BoolTrue, util.BoolFalse}, []string{"True", "False"}, indent) %} {% endstripspace %}{% endfunc %}
{% func BoolTable(key string, title string, value bool, indent int, help ...string) %}{% stripspace %} {%= RadioTable(key, title, fmt.Sprint(value), []string{util.BoolTrue, util.BoolFalse}, []string{"True", "False"}, indent) %} {% endstripspace %}{% endfunc %}
|