github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vprofile/Profile.html (about) 1 <!-- Content managed by Project Forge, see [projectforge.md] for details. --> 2 {% import ( 3 "github.com/kyleu/dbaudit/app" 4 "github.com/kyleu/dbaudit/app/controller/cutil" 5 "github.com/kyleu/dbaudit/app/lib/auth" 6 "github.com/kyleu/dbaudit/app/lib/theme" 7 "github.com/kyleu/dbaudit/app/lib/user" 8 "github.com/kyleu/dbaudit/views/components" 9 "github.com/kyleu/dbaudit/views/components/edit" 10 "github.com/kyleu/dbaudit/views/layout" 11 "github.com/kyleu/dbaudit/views/vauth" 12 "github.com/kyleu/dbaudit/views/vtheme" 13 ) %} 14 15 {% code type Profile struct { 16 layout.Basic 17 Profile *user.Profile 18 Theme *theme.Theme 19 Providers auth.Providers 20 Referrer string 21 } %} 22 23 {% func (p *Profile) Body(as *app.State, ps *cutil.PageState) %} 24 {%= vauth.SigninTable(p.Providers, p.Referrer, as, ps) %} 25 <form action="" method="post"> 26 <input name="referrer" type="hidden" value="{%s p.Referrer %}" /> 27 <div class="card"> 28 <div class="right"> 29 <a href="#modal-profile"><button type="button">Profile</button></a> 30 <a href="#modal-theme"><button type="button">Theme</button></a> 31 </div> 32 <h3>Profile</h3> 33 <div class="overflow full-width"> 34 <table class="mt expanded"> 35 <tbody> 36 {%= edit.StringTable("name", "", "Name", ps.Username(), 5) %} 37 <tr> 38 <th class="shrink"><label>Mode</label></th> 39 <td> 40 <label> 41 {%- if p.Profile.Mode == "" -%} 42 <input type="radio" class="mode-input" name="mode" value="" checked="checked" /> 43 {%- else -%} 44 <input type="radio" class="mode-input" name="mode" value="" /> 45 {%- endif -%} 46 System Default 47 </label> 48 <label> 49 {%- if p.Profile.Mode == "light" -%} 50 <input type="radio" class="mode-input" name="mode" value="light" checked="checked" /> 51 {%- else -%} 52 <input type="radio" class="mode-input" name="mode" value="light" /> 53 {%- endif -%} 54 Light 55 </label> 56 <label> 57 {%- if p.Profile.Mode == "dark" -%} 58 <input type="radio" class="mode-input" name="mode" value="dark" checked="checked" /> 59 {%- else -%} 60 <input type="radio" class="mode-input" name="mode" value="dark" /> 61 {%- endif -%} 62 Dark 63 </label> 64 </td> 65 </tr> 66 {%= vtheme.ChoicePanel(as.Themes.All(ps.Logger), "app", 5, ps) %} 67 </tbody> 68 </table> 69 </div> 70 <div class="mt"> 71 <button type="submit">Save All Changes</button> 72 <button type="reset">Reset</button> 73 </div> 74 </div> 75 </form> 76 77 {%= components.JSONModal("profile", "Profile JSON", p.Profile, 1) %} 78 {%= components.JSONModal("theme", "Theme JSON", p.Theme, 1) %} 79 {% endfunc %}