commit 403e7a723f3dfc55ae926d8b2bb4927ab5ffd747
parent 864abbc1463d354334ab7c48a076e44d413deb6e
Author: Peter Kosyh <p.kosyh@gmail.com>
Date: Fri, 4 Sep 2020 18:15:17 +0300
style
Diffstat:
5 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/ii-node/lib/style.css b/ii-node/lib/style.css
@@ -165,6 +165,7 @@
}
#profile .links, #login .links {
text-align: center;
+ margin: 10pt;
}
@media (max-width: 640px) {
.extra {
diff --git a/ii-node/tpl/header.tpl b/ii-node/tpl/header.tpl
@@ -20,10 +20,16 @@
<td class="links">
<span>
{{ if .User.Name }}
+ {{ if eq .BasePath "profile" }}
+ <a href="/logout">Logout</a>
+ {{ else }}
<a href="/profile">{{.User.Name}}</a>
- {{else}}
+ {{ end }}
+ {{ else if eq .BasePath "login" }}
+ <a href="/register">Register</a>
+ {{ else }}
<a href="/login">Login</a>
- {{end}}
+ {{ end }}
{{ with .Echo }}
:: <a href="/{{.}}/new">New topic</a>
{{ end }}
diff --git a/ii-node/tpl/login.tpl b/ii-node/tpl/login.tpl
@@ -1,4 +1,4 @@
-{{template "header.tpl"}}
+{{template "header.tpl" $}}
<form method="post" enctype="application/x-www-form-urlencoded" action="/login">
<table id="login" cellspacing=0 cellpadding=0>
diff --git a/ii-node/tpl/profile.tpl b/ii-node/tpl/profile.tpl
@@ -1,10 +1,10 @@
-{{template "header.tpl"}}
+{{template "header.tpl" $}}
<table id="profile" cellspacing=0 cellpadding=0>
<tr class="odd"><td>Login:</td><td>{{.User.Name}}</td></tr>
<tr class="even"><td>Auth:</td><td>{{.User.Secret}}</td></tr>
<tr class="odd"><td>e-mail:</td><td>{{.User.Mail}}</td></tr>
-<tr class="even"><td class="links" colspan="2"><a href="/logout">Logout</a>
-</td></tr>
+<!-- <tr class="even"><td class="links" colspan="2"><a href="/logout">Logout</a>
+</td></tr> -->
</table>
{{template "footer.tpl"}}
diff --git a/ii-node/web.go b/ii-node/web.go
@@ -56,7 +56,7 @@ func www_register(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request
}
func www_login(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request) error {
- ctx := WebContext{ User: user }
+ ctx := WebContext{ User: user, BasePath: "login" }
ii.Trace.Printf("www login")
switch r.Method {
case "GET":
@@ -85,7 +85,7 @@ func www_login(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request) e
}
func www_profile(user *ii.User, www WWW, w http.ResponseWriter, r *http.Request) error {
- ctx := WebContext{ User: user }
+ ctx := WebContext{ User: user, BasePath: "profile" }
ii.Trace.Printf("www profile")
if user.Name == "" {
ii.Error.Printf("Access denied")