Core

/views/components/view/Fields.html (812 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{% import (
"{{{ .Package }}}/app/controller/cutil"
"{{{ .Package }}}/app/util"
) %}

{% func Fields(fields util.FieldDescs, values util.ValueMap, ps *cutil.PageState) %}{% stripspace %}
{%- for _, arg := range fields -%}
{%- switch arg.Type -%}
{%- case "bool" -%}
{%= BoolTable(arg.TitleSafe(), values.GetBoolOr(arg.Key, arg.DefaultBool(), true), 3, ps) %}
{%- case "number", "int" -%}
{%= IntTable(arg.TitleSafe(), values.GetIntOr(arg.Key, arg.DefaultInt(), true), 3) %}
{%- case "float" -%}
{%= FloatTable(arg.TitleSafe(), values.GetFloatOr(arg.Key, arg.DefaultFloat(), true), 3) %}
{%- default -%}
{%= StringTable(arg.TitleSafe(), values.GetStringOr(arg.Key, arg.Default, true), 3) %}
{%- endswitch -%}
{%- endfor -%}
{% endstripspace %}{% endfunc %}