summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Minko <vitaly.minko@gmail.com>2019-06-09 15:35:32 +0300
committerVitaly Minko <vitaly.minko@gmail.com>2019-06-09 15:35:32 +0300
commiteee321e1e760129e23b7a5a7a5b7db6e09033770 (patch)
tree5cbff600658d37161e5cbb6d778c53365c448ac1
parenta36fc89449e0284428f18eade1bc0efd9411ea3b (diff)
Implemented owner's profile page.
-rw-r--r--cmd/dscuss-cli/main.go2
-rw-r--r--cmd/dscuss-web/controller/board_handlers.go16
-rw-r--r--cmd/dscuss-web/controller/common_data.go6
-rw-r--r--cmd/dscuss-web/controller/controller.go23
-rw-r--r--cmd/dscuss-web/controller/login_handlers.go4
-rw-r--r--cmd/dscuss-web/controller/reply_handlers.go5
-rw-r--r--cmd/dscuss-web/controller/start_handler.go6
-rw-r--r--cmd/dscuss-web/controller/thread_handlers.go6
-rw-r--r--cmd/dscuss-web/main.go2
-rw-r--r--cmd/dscuss-web/static/css.go5
-rw-r--r--cmd/dscuss-web/static/js.go42
-rw-r--r--cmd/dscuss-web/view/base.go8
-rw-r--r--cmd/dscuss-web/view/board.go8
-rw-r--r--cmd/dscuss-web/view/login.go5
-rw-r--r--cmd/dscuss-web/view/profile.go85
-rw-r--r--cmd/dscuss-web/view/reply.go59
-rw-r--r--cmd/dscuss-web/view/start.go40
-rw-r--r--cmd/dscuss-web/view/templates.go1
-rw-r--r--cmd/dscuss-web/view/thread.go3
-rw-r--r--dscuss.go4
20 files changed, 262 insertions, 68 deletions
diff --git a/cmd/dscuss-cli/main.go b/cmd/dscuss-cli/main.go
index 3531d63..3f43203 100644
--- a/cmd/dscuss-cli/main.go
+++ b/cmd/dscuss-cli/main.go
@@ -604,7 +604,7 @@ func doListSubscriptions(c *ishell.Context) {
return
}
subs := loginHandle.ListSubscriptions()
- c.Print(subs)
+ c.Print(subs.String())
}
func doMakeModerator(c *ishell.Context) {
diff --git a/cmd/dscuss-web/controller/board_handlers.go b/cmd/dscuss-web/controller/board_handlers.go
index a02a5f7..5046418 100644
--- a/cmd/dscuss-web/controller/board_handlers.go
+++ b/cmd/dscuss-web/controller/board_handlers.go
@@ -19,7 +19,6 @@ package controller
import (
"net/http"
"regexp"
- "time"
"vminko.org/dscuss"
"vminko.org/dscuss/cmd/dscuss-web/view"
"vminko.org/dscuss/entity"
@@ -64,19 +63,14 @@ func boardHandler(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle,
for _, msg := range messages {
threads = append(threads, RootMessage{})
t := &threads[len(threads)-1]
- t.ID = msg.ID().String()
- t.Topic = msg.Topic.String()
- t.Subject = msg.Subject
- t.Text = msg.Text
- t.DateWritten = msg.DateWritten.Format(time.RFC3339)
- t.AuthorID = msg.AuthorID.String()
- t.AuthorShortID = msg.AuthorID.Shorten()
- t.AuthorName = userName(l, &msg.AuthorID)
+ t.Assign(msg, l)
}
+ cd := readCommonData(r, s, l)
+ cd.PageTitle = "Board"
+ cd.Topic = topicStr
view.Render(w, "board.html", map[string]interface{}{
- "Common": readCommonData(r, s, l),
- "Topic": topicStr,
+ "Common": cd,
"Threads": threads,
})
}
diff --git a/cmd/dscuss-web/controller/common_data.go b/cmd/dscuss-web/controller/common_data.go
index d2de748..79014a0 100644
--- a/cmd/dscuss-web/controller/common_data.go
+++ b/cmd/dscuss-web/controller/common_data.go
@@ -21,6 +21,7 @@ import (
"net/http"
"net/url"
"strings"
+ "time"
"vminko.org/dscuss"
"vminko.org/dscuss/cmd/dscuss-web/config"
)
@@ -30,8 +31,11 @@ type CommonData struct {
OwnerName string
OwnerID string
OwnerShortID string
+ OwnerInfo string
+ OwnerRegDate string
NodeName string
PageTitle string
+ Topic string
CurrentURL template.URL
ShowLogin bool
IsWritingPermitted bool
@@ -51,6 +55,8 @@ func readCommonData(r *http.Request, s *Session, l *dscuss.LoginHandle) *CommonD
res.OwnerName = u.Nickname
res.OwnerID = u.ID().String()
res.OwnerShortID = u.ID().Shorten()
+ res.OwnerInfo = u.Info
+ res.OwnerRegDate = u.RegDate.Format(time.RFC3339)
res.IsWritingPermitted = true
}
if r.URL.Path != "" {
diff --git a/cmd/dscuss-web/controller/controller.go b/cmd/dscuss-web/controller/controller.go
index 8cf2b48..6dd1674 100644
--- a/cmd/dscuss-web/controller/controller.go
+++ b/cmd/dscuss-web/controller/controller.go
@@ -61,6 +61,13 @@ func CSSHandler(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, static.CSS)
}
+func JavaScriptHandler(w http.ResponseWriter, r *http.Request) {
+ defer InternalServerErrorHandler(w, r)
+ w.Header().Set("Content-Type", "text/javascript")
+ w.Header().Set("Cache-Control", "max-age=31536000, public")
+ io.WriteString(w, static.JavaScript)
+}
+
func MakeRootHandler(l *dscuss.LoginHandle) http.HandlerFunc {
return makeHandler(
func(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle, s *Session) {
@@ -106,6 +113,22 @@ func userName(l *dscuss.LoginHandle, id *entity.ID) string {
}
}
+type User struct {
+ ID string
+ ShortID string
+ Nickname string
+ Info string
+ RegDate string
+}
+
+func (u *User) Assign(eu *entity.User, l *dscuss.LoginHandle) {
+ u.ID = eu.ID().String()
+ u.ShortID = eu.ID().Shorten()
+ u.Nickname = eu.Nickname
+ u.Info = eu.Info
+ u.RegDate = eu.RegDate.Format(time.RFC3339)
+}
+
type Message struct {
ID string
Subject string
diff --git a/cmd/dscuss-web/controller/login_handlers.go b/cmd/dscuss-web/controller/login_handlers.go
index 6d4d079..f756b0b 100644
--- a/cmd/dscuss-web/controller/login_handlers.go
+++ b/cmd/dscuss-web/controller/login_handlers.go
@@ -60,8 +60,10 @@ func loginHandler(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle,
return
}
}
+ cd := readCommonData(r, s, l)
+ cd.PageTitle = "Owner authentication"
view.Render(w, "login.html", map[string]interface{}{
- "Common": readCommonData(r, s, l),
+ "Common": cd,
"next": template.URL(url.QueryEscape(redirectURL)),
"Message": msg,
})
diff --git a/cmd/dscuss-web/controller/reply_handlers.go b/cmd/dscuss-web/controller/reply_handlers.go
index f92f646..2958ffd 100644
--- a/cmd/dscuss-web/controller/reply_handlers.go
+++ b/cmd/dscuss-web/controller/reply_handlers.go
@@ -97,8 +97,11 @@ func replyHandler(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle,
return
}
render:
+ cd := readCommonData(r, s, l)
+ cd.PageTitle = "Reply to " + rm.Subject
+ cd.Topic = rm.Topic
view.Render(w, "reply.html", map[string]interface{}{
- "Common": readCommonData(r, s, l),
+ "Common": cd,
"Thread": rm,
"Parent": pm,
"Reply": rpl,
diff --git a/cmd/dscuss-web/controller/start_handler.go b/cmd/dscuss-web/controller/start_handler.go
index 9826c4c..bdbb8ef 100644
--- a/cmd/dscuss-web/controller/start_handler.go
+++ b/cmd/dscuss-web/controller/start_handler.go
@@ -75,9 +75,11 @@ func startHandler(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle,
return
}
render:
+ cd := readCommonData(r, s, l)
+ cd.PageTitle = "Start new dscussion"
+ cd.Topic = topic
view.Render(w, "start.html", map[string]interface{}{
- "Common": readCommonData(r, s, l),
- "Topic": topic,
+ "Common": cd,
"Subject": subj,
"Text": text,
"Message": msg,
diff --git a/cmd/dscuss-web/controller/thread_handlers.go b/cmd/dscuss-web/controller/thread_handlers.go
index 02dcb55..2b6c3f2 100644
--- a/cmd/dscuss-web/controller/thread_handlers.go
+++ b/cmd/dscuss-web/controller/thread_handlers.go
@@ -66,10 +66,12 @@ func threadHandler(w http.ResponseWriter, r *http.Request, l *dscuss.LoginHandle
tc := ThreadComposer{&t, l}
tvis := thread.NewViewingVisitor(&tc)
node.View(tvis)
+ cd := readCommonData(r, s, l)
+ cd.PageTitle = t.Subject
+ cd.Topic = t.Topic
view.Render(w, "thread.html", map[string]interface{}{
- "Common": readCommonData(r, s, l),
+ "Common": cd,
"ID": t.ID,
- "Topic": t.Topic,
"Subject": t.Subject,
"Text": t.Text,
"DateWritten": t.DateWritten,
diff --git a/cmd/dscuss-web/main.go b/cmd/dscuss-web/main.go
index bad5144..a1aa71f 100644
--- a/cmd/dscuss-web/main.go
+++ b/cmd/dscuss-web/main.go
@@ -124,12 +124,14 @@ func main() {
}
http.HandleFunc("/static/dscuss.css", controller.CSSHandler)
+ http.HandleFunc("/static/dscuss.js", controller.JavaScriptHandler)
http.HandleFunc("/board", controller.MakeBoardHandler(loginHandle))
http.HandleFunc("/login", controller.MakeLoginHandler(loginHandle))
http.HandleFunc("/logout", controller.LogoutHandler)
http.HandleFunc("/thread", controller.MakeThreadHandler(loginHandle))
http.HandleFunc("/reply", controller.MakeReplyHandler(loginHandle))
http.HandleFunc("/start", controller.MakeStartHandler(loginHandle))
+ http.HandleFunc("/profile", controller.MakeProfileHandler(loginHandle))
http.HandleFunc("/", controller.MakeRootHandler(loginHandle))
log.Debugf("Starting HTTP server on port %d\n", webPort)
diff --git a/cmd/dscuss-web/static/css.go b/cmd/dscuss-web/static/css.go
index f84611f..168c28e 100644
--- a/cmd/dscuss-web/static/css.go
+++ b/cmd/dscuss-web/static/css.go
@@ -162,6 +162,7 @@ th, td {
}
.form th {
text-align: right;
+ vertical-align: top;
padding-top: 10px;
}
.form td {
@@ -187,7 +188,7 @@ th, td {
width: 100%;
}
}
-.form input[type="text"], .form input[type="number"], .form input[type="password"] {
+input[type="text"], input[type="number"], input[type="password"] {
width: 100%;
}
textarea {
@@ -240,3 +241,5 @@ a, .dimmed, h3, .message p {
color: grey;
}
`
+
+/* vim: set filetype=css: */
diff --git a/cmd/dscuss-web/static/js.go b/cmd/dscuss-web/static/js.go
new file mode 100644
index 0000000..0515b7d
--- /dev/null
+++ b/cmd/dscuss-web/static/js.go
@@ -0,0 +1,42 @@
+/*
+This file is part of Dscuss.
+Copyright (C) 2019 Vitaly Minko
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation, either version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+package static
+
+// JavaScript is based on js from https://github.com/s-gv/orangeforum
+
+const JavaScript = `
+var inputs = document.getElementsByClassName("no-double-post");
+for (var i = 0; i < inputs.length; i++) {
+ if (inputs[i].type == "submit") {
+ var btn = inputs[i];
+ var form = btn.form;
+ if (!!form && form.method == "post") {
+ btn.onclick = function() {
+ var form = this.form;
+ if(!!form && form.checkValidity()) {
+ var submitBtn = this;
+ setTimeout(function() {
+ submitBtn.disabled = true;
+ }, 1);
+ }
+ };
+ }
+ }
+}
+`
+
+/* vim: set filetype=javascript: */
diff --git a/cmd/dscuss-web/view/base.go b/cmd/dscuss-web/view/base.go
index 3aa147e..47a7444 100644
--- a/cmd/dscuss-web/view/base.go
+++ b/cmd/dscuss-web/view/base.go
@@ -27,7 +27,7 @@ const baseHTML = `
<link rel="stylesheet" type="text/css" href="/static/dscuss.css">
<title>
{{ if .Common.PageTitle }}
- {{ .Common.PageTitle }}
+ {{ .Common.NodeName }} &mdash; {{ .Common.PageTitle }}
{{ else }}
{{ .Common.NodeName }}
{{ end }}
@@ -39,10 +39,14 @@ const baseHTML = `
<div id="header" class="clearfix">
<div id="navleft">
<a href="/">{{ .Common.NodeName }}</a>
+ {{ if .Common.Topic }}
+ &mdash; <a href="/board?topic=">{{ .Common.Topic }}</a>
+ {{ end }}
</div>
<div id="navright">
{{ if .Common.OwnerName }}
- {{ .Common.OwnerName }}-{{ .Common.OwnerShortID }} <a href="/logout">Logout</a>
+ <a href="/profile">{{ .Common.OwnerName }}-{{ .Common.OwnerShortID }}</a>
+ <a href="/logout">Logout</a>
{{ else }}
{{ if .Common.ShowLogin }}
<a href="/login?next={{ .Common.CurrentURL }}">Login</a>
diff --git a/cmd/dscuss-web/view/board.go b/cmd/dscuss-web/view/board.go
index bee7a6a..71b7fc8 100644
--- a/cmd/dscuss-web/view/board.go
+++ b/cmd/dscuss-web/view/board.go
@@ -22,13 +22,13 @@ const boardHTML = `
{{ if .Common.IsWritingPermitted }}
<div class="btn-row">
- <a class="link-btn" href="/start{{ if $.Topic }}?topic={{ $.Topic }}{{ end }}">Start</a>
+ <a class="link-btn" href="/start{{ if $.Common.Topic }}?topic={{ $.Common.Topic }}{{ end }}">Start</a>
</div>
{{end}}
<h1> Dscussions in
-{{ if .Topic }}
-topic {{ .Topic }}
+{{ if .Common.Topic }}
+topic {{ .Common.Topic }}
{{ else }}
all topics
{{ end }}
@@ -40,7 +40,7 @@ all topics
<div class="thread-row" id="thread-{{ .ID }}">
<div>
<a href="/thread?id={{ .ID }}">{{ .Subject }}</a>
- {{ if not $.Topic }}
+ {{ if not $.Common.Topic }}
<span class="topic">in <a class="topic" href="/board?topic={{ .Topic }}">{{ .Topic }}</a></span>
{{ end }}
</div>
diff --git a/cmd/dscuss-web/view/login.go b/cmd/dscuss-web/view/login.go
index b55cf4a..e9b9811 100644
--- a/cmd/dscuss-web/view/login.go
+++ b/cmd/dscuss-web/view/login.go
@@ -20,15 +20,12 @@ package view
const loginHTML = `
{{ define "content" }}
+<h2 class="title">Owner authentication</h2>
<form action="/login" method="POST">
<input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
<input type="hidden" name="next" value="{{ .next }}">
<table class="form">
<tr>
- <th></th>
- <td>Owner authentication</td>
- </tr>
- <tr>
<th>Username:</th>
<td><input type="text" name="username" required></td>
</tr>
diff --git a/cmd/dscuss-web/view/profile.go b/cmd/dscuss-web/view/profile.go
new file mode 100644
index 0000000..1df2c3f
--- /dev/null
+++ b/cmd/dscuss-web/view/profile.go
@@ -0,0 +1,85 @@
+/*
+This file is part of Dscuss.
+Copyright (C) 2019 Vitaly Minko
+
+This program is free software: you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation, either version 3 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+package view
+
+const profileHTML = `
+{{ define "content" }}
+
+<h2 class="title">Node owner's profile</h1>
+<table class="form">
+ <tr><th>Full ID</th><td>{{ .Common.OwnerID }}</td></tr>
+ <tr><th>Nickname</th><td>{{ .Common.OwnerName }}</td></tr>
+ <tr><th>Additional info</th><td>{{ .Common.OwnerInfo }}</td></tr>
+ <tr><th>Registration date</th><td>{{ .Common.OwnerRegDate }}</td></tr>
+</table>
+<hr class="sep">
+<span class="subtitle">Subscriptions</span>
+<form action="/sub" method="POST" enctype="multipart/form-data">
+<input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
+<table>
+ <tr>
+ <th>Topic</th>
+ <th>Action</th>
+ </tr>
+{{ range .Subscriptions }}
+ <tr>
+ <td>{{ . }}</td>
+ <td><a href="/unsub?id={{ . }}">Remove</a></td>
+ </tr>
+{{ end }}
+ <tr>
+ <th>
+ <input type="text" name="topic" placeholder="Enter new topic...">
+ </th>
+ <th>
+ <input type="submit" name="action" class="no-double-post" value="Subscribe">
+ </th>
+ </tr>
+</table>
+</form>
+<hr class="sep">
+<span class="subtitle">Moderators</span>
+<form action="/mkmdr" method="POST" enctype="multipart/form-data">
+<input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
+<table>
+ <tr>
+ <th>User</th>
+ <th>Action</th>
+ </tr>
+{{ range .Moderators }}
+ <tr>
+ <td><a href="/profile?id={{ .ID }}">{{ .Nickname }}-{{ .ShortID }}</a></td>
+ <td><a href="/rmmdr?id={{ .ID }}">Remove</a></td>
+ </tr>
+{{ end }}
+ <tr>
+ <td>
+ <input type="text" name="id" placeholder="Enter new full ID...">
+ </td>
+ <td>
+ <input type="submit" name="action" class="no-double-post" value="Add">
+ </td>
+ </tr>
+</table>
+</form>
+{{ if .Message }}
+ <span class="alert">{{ .Message }}</span><br>
+{{ end }}
+{{ end }}`
+
+/* vim: set filetype=html: */
diff --git a/cmd/dscuss-web/view/reply.go b/cmd/dscuss-web/view/reply.go
index 46d6239..23a27d0 100644
--- a/cmd/dscuss-web/view/reply.go
+++ b/cmd/dscuss-web/view/reply.go
@@ -20,28 +20,43 @@ package view
const replyHTML = `
{{ define "content" }}
-<h2 id="title">Reply to <a href="/thread?id={{ .Thread.ID }}">{{ .Thread.Subject }}</a></h2>
-<span class="topic">in <a href="/board?topic={{ .Thread.Topic }}">{{ .Thread.Topic }}</a></span>
-{{ if .ShowParentSubject }}
-<b>{{ .Parent.Subject }}</b>
-{{ end }}
-<div class="message-text">{{ .Parent.Text }}</div>
-<div class="dimmed underline">
- by <a href="/user?u={{ .Parent.AuthorID }}">{{ .Parent.AuthorName }}-{{ .Parent.AuthorShortID }}</a>
- {{ .Parent.DateWritten }}
-</div>
-<div class="row">
- <form action="/reply" method="POST" enctype="multipart/form-data">
- <input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
- <input type="hidden" name="id" value="{{ .Parent.ID }}">
- Subject: <input type="text" name="subject" value="{{ .Reply.Subject }}" placeholder="Re: {{.Parent.Subject}}">
- <textarea name="text" rows="12">{{ .Reply.Text }}</textarea>
- {{ if .Message }}
- <span class="alert">{{ .Message }}</span><br>
- {{ end }}
- <input type="submit" name="action" class="no-double-post" value="Submit reply">
- </form>
-</div>
+<h2 class="title">Reply to <a href="/thread?id={{ .Thread.ID }}">{{ .Thread.Subject }}</a></h2>
+<form action="/reply" method="POST" enctype="multipart/form-data">
+<input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
+<input type="hidden" name="id" value="{{ .Parent.ID }}">
+<table class="form">
+ <tr>
+ <td colspan="2">
+ {{ if .ShowParentSubject }}
+ <b>{{ .Parent.Subject }}</b>
+ {{ end }}
+ <div class="message-text">{{ .Parent.Text }}</div>
+ <div class="dimmed underline">
+ by <a href="/user?u={{ .Parent.AuthorID }}">{{ .Parent.AuthorName }}-{{ .Parent.AuthorShortID }}</a>
+ {{ .Parent.DateWritten }}
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th>Subject:</th>
+ <td><input type="text" name="subject" value="{{ .Reply.Subject }}" placeholder="Re: {{.Parent.Subject}}"></td>
+ </tr>
+ <tr>
+ <th>Text:</th>
+ <td><textarea name="text" rows="12">{{ .Reply.Text }}</textarea></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td>
+ {{ if .Message }}
+ <span class="alert">{{ .Message }}</span><br>
+ {{ end }}
+ <input type="submit" name="action" class="no-double-post" value="Submit reply">
+ </td>
+ </tr>
+
+</table>
+</form>
{{ end }}`
diff --git a/cmd/dscuss-web/view/start.go b/cmd/dscuss-web/view/start.go
index a5eb9e3..964cec3 100644
--- a/cmd/dscuss-web/view/start.go
+++ b/cmd/dscuss-web/view/start.go
@@ -20,19 +20,33 @@ package view
const startHTML = `
{{ define "content" }}
-<h2 id="title">Start new dscussion</h2>
-<div class="row">
- <form action="/start" method="POST" enctype="multipart/form-data">
- <input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
- Topic: <input type="text" name="topic" value="{{ .Topic }}"><br>
- Subject: <input type="text" name="subject" value="{{ .Subject }}">
- <textarea name="text" rows="12">{{ .Text }}</textarea>
- {{ if .Message }}
- <span class="alert">{{ .Message }}</span><br>
- {{ end }}
- <input type="submit" name="action" class="no-double-post" value="Start dscussion">
- </form>
-</div>
+<h2 class="title">Start new dscussion</h2>
+<form action="/start" method="POST" enctype="multipart/form-data">
+<input type="hidden" name="csrf" value="{{ .Common.CSRF }}">
+<table class="form">
+ <tr>
+ <th>Topic:</th>
+ <td><input type="text" name="topic" value="{{ .Common.Topic }}"></td>
+ </tr>
+ <tr>
+ <th>Subject:</th>
+ <td><input type="text" name="subject" value="{{ .Subject }}"></td>
+ </tr>
+ <tr>
+ <th>Text:</th>
+ <td><textarea name="text" rows="12">{{ .Text }}</textarea></td>
+ </tr>
+ <tr>
+ <th></th>
+ <td>
+ {{ if .Message }}
+ <span class="alert">{{ .Message }}</span><br>
+ {{ end }}
+ <input type="submit" name="action" class="no-double-post" value="Start dscussion">
+ </td>
+ </tr>
+</table>
+</form>
{{ end }}`
diff --git a/cmd/dscuss-web/view/templates.go b/cmd/dscuss-web/view/templates.go
index d62b486..3139c6a 100644
--- a/cmd/dscuss-web/view/templates.go
+++ b/cmd/dscuss-web/view/templates.go
@@ -41,6 +41,7 @@ func init() {
templates.Add(base, "thread", threadHTML)
templates.Add(base, "reply", replyHTML)
templates.Add(base, "start", startHTML)
+ templates.Add(base, "profile", profileHTML)
}
func Render(w http.ResponseWriter, tmplName string, data interface{}) {
diff --git a/cmd/dscuss-web/view/thread.go b/cmd/dscuss-web/view/thread.go
index 488a583..9f77e81 100644
--- a/cmd/dscuss-web/view/thread.go
+++ b/cmd/dscuss-web/view/thread.go
@@ -26,8 +26,7 @@ const threadHTML = `
</div>
{{end}}
-<h2 id="title"><a href="/thread?id={{ .ID }}">{{ .Subject }}</a></h2>
-<span class="topic">in <a href="/board?topic={{ .Topic }}">{{ .Topic }}</a></span>
+<h2 class="title"><a href="/thread?id={{ .ID }}">{{ .Subject }}</a></h2>
<div class="message-row">
<div class="message-text">{{ .Text }}</div>
<div class="dimmed underline">
diff --git a/dscuss.go b/dscuss.go
index 2706f1b..d8adf8f 100644
--- a/dscuss.go
+++ b/dscuss.go
@@ -315,8 +315,8 @@ func (lh *LoginHandle) Unsubscribe(topic subs.Topic) error {
return lh.owner.Profile.RemoveSubscription(topic)
}
-func (lh *LoginHandle) ListSubscriptions() string {
- return lh.owner.Profile.GetSubscriptions().String()
+func (lh *LoginHandle) ListSubscriptions() subs.Subscriptions {
+ return lh.owner.Profile.GetSubscriptions()
}
func (lh *LoginHandle) MakeModerator(id *entity.ID) error {