github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/components/edit/Float.html (about) 1 <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 2 {% import ( 3 "github.com/kyleu/dbaudit/app/controller/cutil" 4 "github.com/kyleu/dbaudit/views/components" 5 ) %} 6 7 {% func Float(key string, id string, value any, placeholder ...string) %}{% stripspace %} 8 {% if id == "" %} 9 <input name="{%s key %}" type="number" value="{%v value %}"{%= components.PlaceholderFor(placeholder) %} /> 10 {% else %} 11 <input id="{%s id %}" name="{%s key %}" type="number" value="{%v value %}"{%= components.PlaceholderFor(placeholder) %} /> 12 {% endif %} 13 {% endstripspace %}{% endfunc %} 14 15 {% func FloatVertical(key string, id string, title string, value float64, indent int, help ...string) %}{% stripspace %} 16 {%- code id = cutil.CleanID(key, id) -%} 17 <div class="mb expanded"> 18 {%= components.Indent(true, indent + 1) %} 19 <label for="{%s id %}"><em class="title">{%s title %}</em></label> 20 {%= components.Indent(true, indent + 1) %} 21 <div class="mt">{%= Float(key, id, value, help...) %}</div> 22 {%= components.Indent(true, indent) %} 23 </div> 24 {% endstripspace %}{% endfunc %} 25 26 {% func FloatTable(key string, id string, title string, value float64, indent int, help ...string) %}{% stripspace %} 27 {%- code id = cutil.CleanID(key, id) -%} 28 <tr> 29 {%= components.Indent(true, indent + 1) %} 30 <th class="shrink"><label for="{%s id %}"{%= components.TitleFor(help) %}>{%s title %}</label></th> 31 {%= components.Indent(true, indent + 1) %} 32 <td>{%= Float(key, id, value, help...) %}</td> 33 {%= components.Indent(true, indent) %} 34 </tr> 35 {% endstripspace %}{% endfunc %}