allow setting a few more custom messages
This commit is contained in:
parent
5d7ed580b4
commit
47bdc1256b
|
@ -81,14 +81,12 @@ Site CSS may be overridden by creating a
|
||||||
.Pa views/local.css
|
.Pa views/local.css
|
||||||
file.
|
file.
|
||||||
.Pp
|
.Pp
|
||||||
A custom message me be set by editing the database.
|
Custom messages may be set by editing the database.
|
||||||
(Sorry.)
|
(Sorry.)
|
||||||
.Dl insert into config values ('servermsg', 'message');
|
.Dl insert into config values ('servermsg', 'message');
|
||||||
|
.Dl insert into config values ('aboutmsg', 'message');
|
||||||
|
.Dl insert into config values ('loginmsg', 'message');
|
||||||
.Pp
|
.Pp
|
||||||
The
|
|
||||||
.Pa views/about.html
|
|
||||||
page doesn't change too frequently.
|
|
||||||
It should be safe to edit.
|
|
||||||
.Ss ADMIN
|
.Ss ADMIN
|
||||||
New users can be added with the
|
New users can be added with the
|
||||||
.Ic adduser
|
.Ic adduser
|
||||||
|
|
6
honk.go
6
honk.go
|
@ -137,7 +137,9 @@ type Honker struct {
|
||||||
|
|
||||||
var serverName string
|
var serverName string
|
||||||
var iconName = "icon.png"
|
var iconName = "icon.png"
|
||||||
var serverMsg = "Things happen."
|
var serverMsg = template.HTML(`<h2>Things happen.</h2>`)
|
||||||
|
var aboutMsg = template.HTML(`<h3>What is honk?</h3><p>Honk is amazing!`)
|
||||||
|
var loginMsg = template.HTML(`<h2>login</h2>`)
|
||||||
|
|
||||||
func ElaborateUnitTests() {
|
func ElaborateUnitTests() {
|
||||||
}
|
}
|
||||||
|
@ -160,6 +162,8 @@ func main() {
|
||||||
log.Fatal("incorrect database version. run upgrade.")
|
log.Fatal("incorrect database version. run upgrade.")
|
||||||
}
|
}
|
||||||
getconfig("servermsg", &serverMsg)
|
getconfig("servermsg", &serverMsg)
|
||||||
|
getconfig("aboutmsg", &aboutMsg)
|
||||||
|
getconfig("loginmsg", &loginMsg)
|
||||||
getconfig("servername", &serverName)
|
getconfig("servername", &serverName)
|
||||||
getconfig("usersep", &userSep)
|
getconfig("usersep", &userSep)
|
||||||
getconfig("honksep", &honkSep)
|
getconfig("honksep", &honkSep)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{{ template "header.html" . }}
|
{{ template "header.html" . }}
|
||||||
<main>
|
<main>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<h3>What is honk?</h3>
|
{{ .AboutMsg }}
|
||||||
<p>Honk is amazing!
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{{ template "header.html" . }}
|
{{ template "header.html" . }}
|
||||||
<main>
|
<main>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
|
{{ .LoginMsg }}
|
||||||
<form action="/dologin" method="POST">
|
<form action="/dologin" method="POST">
|
||||||
<p><span class="title">login</span>
|
|
||||||
<p><input tabindex=1 type="text" name="username" autocomplete=off> - username
|
<p><input tabindex=1 type="text" name="username" autocomplete=off> - username
|
||||||
<p><input tabindex=1 type="password" name="password"> - password
|
<p><input tabindex=1 type="password" name="password"> - password
|
||||||
<p><button tabindex=1 name="login" value="login">login</button>
|
<p><button tabindex=1 name="login" value="login">login</button>
|
||||||
|
|
4
web.go
4
web.go
|
@ -98,7 +98,7 @@ func homepage(w http.ResponseWriter, r *http.Request) {
|
||||||
userid = u.UserID
|
userid = u.UserID
|
||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case "/atme":
|
case "/atme":
|
||||||
templinfo["PageName"] = "at me!"
|
templinfo["ServerMessage"] = "at me!"
|
||||||
templinfo["PageName"] = "atme"
|
templinfo["PageName"] = "atme"
|
||||||
honks = gethonksforme(userid, 0)
|
honks = gethonksforme(userid, 0)
|
||||||
case "/events":
|
case "/events":
|
||||||
|
@ -1586,6 +1586,8 @@ func servehelp(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
func servehtml(w http.ResponseWriter, r *http.Request) {
|
func servehtml(w http.ResponseWriter, r *http.Request) {
|
||||||
templinfo := getInfo(r)
|
templinfo := getInfo(r)
|
||||||
|
templinfo["AboutMsg"] = aboutMsg
|
||||||
|
templinfo["LoginMsg"] = loginMsg
|
||||||
err := readviews.Execute(w, r.URL.Path[1:]+".html", templinfo)
|
err := readviews.Execute(w, r.URL.Path[1:]+".html", templinfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
|
|
Loading…
Reference in New Issue