github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vtheme/Choice.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/app/lib/theme" 5 "github.com/kyleu/dbaudit/views/components" 6 ) %} 7 8 {% func ChoicePanel(themes theme.Themes, icon string, indent int, ps *cutil.PageState) %}{% stripspace %} 9 {%= components.Indent(true, indent) %} 10 <tr> 11 {%= components.Indent(true, indent + 1) %} 12 <th class="shrink"><label>Theme</label></th> 13 {%= components.Indent(true, indent + 1) %} 14 <td> 15 {%= components.Indent(true, indent + 2) %} 16 <div class="right"><a href="/theme">Edit Themes</a></div> 17 <div class="clear"></div> 18 {% code 19 sel := ps.Profile.Theme 20 if sel == "" { 21 sel = "default" 22 } 23 %} 24 {%= Choice(themes, sel, icon, indent + 2, ps) %} 25 </td> 26 {%= components.Indent(true, indent) %} 27 </tr> 28 {% endstripspace %}{% endfunc %} 29 30 {% func Choice(themes theme.Themes, selected string, icon string, indent int, ps *cutil.PageState) %}{% stripspace %} 31 {%= components.Indent(true, indent) %} 32 <div class="choice"> 33 {% for _, t := range themes %} 34 {%= components.Indent(true, indent + 1) %} 35 <label title="{%s t.Key %}"> 36 {% if t.Key == selected %} 37 <input type="radio" name="theme" value="{%s t.Key %}" checked="checked" /> 38 {% else %} 39 <input type="radio" name="theme" value="{%s t.Key %}" /> 40 {% endif %} 41 {%= MockupTheme(t, true, icon, indent + 2, ps) %} 42 </label> 43 {% endfor %} 44 {%= components.Indent(true, indent) %} 45 </div> 46 {% endstripspace %}{% endfunc %}