Core

/views/vprofile/Profile.html (2.9 KB)

 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"{{{ if .HasAccount }}}
"{{{ .Package }}}/app/lib/auth"{{{ end }}}
"{{{ .Package }}}/app/lib/theme"
"{{{ .Package }}}/app/lib/user"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"{{{ if .HasAccount }}}
"{{{ .Package }}}/views/vauth"{{{ end }}}
"{{{ .Package }}}/views/vtheme"
) %}

{% code type Profile struct {
layout.Basic
Profile *user.Profile
Theme *theme.Theme{{{ if .HasAccount }}}
Providers auth.Providers{{{ end }}}
Referrer string
} %}

{% func (p *Profile) Body(as *app.State, ps *cutil.PageState) %}{{{ if .HasAccount }}}
{%= vauth.SigninTable(p.Providers, p.Referrer, as, ps) %}{{{ end }}}
<form action="" method="post">
<input name="referrer" type="hidden" value="{%s p.Referrer %}" />
<div class="card">
<div class="right">
<a href="#modal-profile"><button type="button">Profile</button></a>
<a href="#modal-theme"><button type="button">Theme</button></a>
</div>
<h3>Profile</h3>
<div class="overflow full-width">
<table class="mt expanded">
<tbody>
{%= components.TableInput("name", "", "Name", ps.Username(), 5) %}
<tr>
<th class="shrink"><label>Mode</label></th>
<td>
<label>
{%- if p.Profile.Mode == "" -%}
<input type="radio" class="mode-input" name="mode" value="" checked="checked" />
{%- else -%}
<input type="radio" class="mode-input" name="mode" value="" />
{%- endif -%}
System Default
</label>
<label>
{%- if p.Profile.Mode == "light" -%}
<input type="radio" class="mode-input" name="mode" value="light" checked="checked" />
{%- else -%}
<input type="radio" class="mode-input" name="mode" value="light" />
{%- endif -%}
Light
</label>
<label>
{%- if p.Profile.Mode == "dark" -%}
<input type="radio" class="mode-input" name="mode" value="dark" checked="checked" />
{%- else -%}
<input type="radio" class="mode-input" name="mode" value="dark" />
{%- endif -%}
Dark
</label>
</td>
</tr>
{%= vtheme.ChoicePanel(as.Themes.All(ps.Logger), "app", 5, ps) %}
</tbody>
</table>
</div>
<div class="mt">
<button type="submit">Save All Changes</button>
<button type="reset">Reset</button>
</div>
</div>
</form>

{%= components.JSONModal("profile", "Profile JSON", p.Profile, 1) %}
{%= components.JSONModal("theme", "Theme JSON", p.Theme, 1) %}
{% endfunc %}