diff --git a/http_auth.go b/http_auth.go
index a9ba5de..9981520 100644
--- a/http_auth.go
+++ b/http_auth.go
@@ -4,9 +4,9 @@ import (
"log"
"net/http"
- "github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
+ "github.com/bouncepaw/mycorrhiza/views"
)
func init() {
@@ -29,7 +29,7 @@ func handlerLogout(w http.ResponseWriter, rq *http.Request) {
log.Println("Unknown user tries to log out")
w.WriteHeader(http.StatusForbidden)
}
- w.Write([]byte(base("Logout?", templates.LogoutHTML(can), u)))
+ w.Write([]byte(base("Logout?", views.LogoutHTML(can), u)))
}
func handlerLogoutConfirm(w http.ResponseWriter, rq *http.Request) {
@@ -45,7 +45,7 @@ func handlerLoginData(w http.ResponseWriter, rq *http.Request) {
err = user.LoginDataHTTP(w, rq, username, password)
)
if err != "" {
- w.Write([]byte(base(err, templates.LoginErrorHTML(err), user.EmptyUser())))
+ w.Write([]byte(base(err, views.LoginErrorHTML(err), user.EmptyUser())))
} else {
http.Redirect(w, rq, "/", http.StatusSeeOther)
}
@@ -59,5 +59,5 @@ func handlerLogin(w http.ResponseWriter, rq *http.Request) {
} else {
w.WriteHeader(http.StatusForbidden)
}
- w.Write([]byte(base("Login", templates.LoginHTML(), user.EmptyUser())))
+ w.Write([]byte(base("Login", views.LoginHTML(), user.EmptyUser())))
}
diff --git a/http_mutators.go b/http_mutators.go
index 0cc3f56..5835420 100644
--- a/http_mutators.go
+++ b/http_mutators.go
@@ -9,7 +9,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/markup"
"github.com/bouncepaw/mycorrhiza/shroom"
- "github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
@@ -161,7 +160,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) {
w,
base(
"Edit "+hyphaName,
- templates.EditHTML(rq, hyphaName, textAreaFill, warning),
+ views.EditHTML(rq, hyphaName, textAreaFill, warning),
u))
}
@@ -193,7 +192,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
w,
base(
"Preview "+hyphaName,
- templates.PreviewHTML(
+ views.PreviewHTML(
rq,
hyphaName,
textData,
diff --git a/templates/common.qtpl b/templates/common.qtpl
deleted file mode 100644
index 2f225ac..0000000
--- a/templates/common.qtpl
+++ /dev/null
@@ -1,19 +0,0 @@
-{% import "net/http" %}
-{% import "github.com/bouncepaw/mycorrhiza/user" %}
-{% import "github.com/bouncepaw/mycorrhiza/views" %}
-
-{% func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) %}
-{%s= views.NavHTML(rq, hyphaName, navType, revisionHash...) %}
-{% endfunc %}
-
-{% func userMenuHTML(u *user.User) %}
-{%s= views.UserMenuHTML(u) %}
-{% endfunc %}
-
-{% func relativeHyphae(relatives string) %}
-{%s= views.RelativeHyphaeHTML(relatives) %}
-{% endfunc %}
-
-{% func subhyphaeMatrix(subhyphae string) %}
-{%s= views.SubhyphaeHTML(subhyphae) %}
-{% endfunc %}
diff --git a/templates/common.qtpl.go b/templates/common.qtpl.go
deleted file mode 100644
index 40293c8..0000000
--- a/templates/common.qtpl.go
+++ /dev/null
@@ -1,183 +0,0 @@
-// Code generated by qtc from "common.qtpl". DO NOT EDIT.
-// See https://github.com/valyala/quicktemplate for details.
-
-//line templates/common.qtpl:1
-package templates
-
-//line templates/common.qtpl:1
-import "net/http"
-
-//line templates/common.qtpl:2
-import "github.com/bouncepaw/mycorrhiza/user"
-
-//line templates/common.qtpl:3
-import "github.com/bouncepaw/mycorrhiza/views"
-
-//line templates/common.qtpl:5
-import (
- qtio422016 "io"
-
- qt422016 "github.com/valyala/quicktemplate"
-)
-
-//line templates/common.qtpl:5
-var (
- _ = qtio422016.Copy
- _ = qt422016.AcquireByteBuffer
-)
-
-//line templates/common.qtpl:5
-func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
-//line templates/common.qtpl:5
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:6
- qw422016.N().S(views.NavHTML(rq, hyphaName, navType, revisionHash...))
-//line templates/common.qtpl:6
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:7
-}
-
-//line templates/common.qtpl:7
-func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
-//line templates/common.qtpl:7
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/common.qtpl:7
- streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
-//line templates/common.qtpl:7
- qt422016.ReleaseWriter(qw422016)
-//line templates/common.qtpl:7
-}
-
-//line templates/common.qtpl:7
-func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
-//line templates/common.qtpl:7
- qb422016 := qt422016.AcquireByteBuffer()
-//line templates/common.qtpl:7
- writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
-//line templates/common.qtpl:7
- qs422016 := string(qb422016.B)
-//line templates/common.qtpl:7
- qt422016.ReleaseByteBuffer(qb422016)
-//line templates/common.qtpl:7
- return qs422016
-//line templates/common.qtpl:7
-}
-
-//line templates/common.qtpl:9
-func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
-//line templates/common.qtpl:9
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:10
- qw422016.N().S(views.UserMenuHTML(u))
-//line templates/common.qtpl:10
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:11
-}
-
-//line templates/common.qtpl:11
-func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
-//line templates/common.qtpl:11
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/common.qtpl:11
- streamuserMenuHTML(qw422016, u)
-//line templates/common.qtpl:11
- qt422016.ReleaseWriter(qw422016)
-//line templates/common.qtpl:11
-}
-
-//line templates/common.qtpl:11
-func userMenuHTML(u *user.User) string {
-//line templates/common.qtpl:11
- qb422016 := qt422016.AcquireByteBuffer()
-//line templates/common.qtpl:11
- writeuserMenuHTML(qb422016, u)
-//line templates/common.qtpl:11
- qs422016 := string(qb422016.B)
-//line templates/common.qtpl:11
- qt422016.ReleaseByteBuffer(qb422016)
-//line templates/common.qtpl:11
- return qs422016
-//line templates/common.qtpl:11
-}
-
-//line templates/common.qtpl:13
-func streamrelativeHyphae(qw422016 *qt422016.Writer, relatives string) {
-//line templates/common.qtpl:13
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:14
- qw422016.N().S(views.RelativeHyphaeHTML(relatives))
-//line templates/common.qtpl:14
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:15
-}
-
-//line templates/common.qtpl:15
-func writerelativeHyphae(qq422016 qtio422016.Writer, relatives string) {
-//line templates/common.qtpl:15
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/common.qtpl:15
- streamrelativeHyphae(qw422016, relatives)
-//line templates/common.qtpl:15
- qt422016.ReleaseWriter(qw422016)
-//line templates/common.qtpl:15
-}
-
-//line templates/common.qtpl:15
-func relativeHyphae(relatives string) string {
-//line templates/common.qtpl:15
- qb422016 := qt422016.AcquireByteBuffer()
-//line templates/common.qtpl:15
- writerelativeHyphae(qb422016, relatives)
-//line templates/common.qtpl:15
- qs422016 := string(qb422016.B)
-//line templates/common.qtpl:15
- qt422016.ReleaseByteBuffer(qb422016)
-//line templates/common.qtpl:15
- return qs422016
-//line templates/common.qtpl:15
-}
-
-//line templates/common.qtpl:17
-func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
-//line templates/common.qtpl:17
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:18
- qw422016.N().S(views.SubhyphaeHTML(subhyphae))
-//line templates/common.qtpl:18
- qw422016.N().S(`
-`)
-//line templates/common.qtpl:19
-}
-
-//line templates/common.qtpl:19
-func writesubhyphaeMatrix(qq422016 qtio422016.Writer, subhyphae string) {
-//line templates/common.qtpl:19
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/common.qtpl:19
- streamsubhyphaeMatrix(qw422016, subhyphae)
-//line templates/common.qtpl:19
- qt422016.ReleaseWriter(qw422016)
-//line templates/common.qtpl:19
-}
-
-//line templates/common.qtpl:19
-func subhyphaeMatrix(subhyphae string) string {
-//line templates/common.qtpl:19
- qb422016 := qt422016.AcquireByteBuffer()
-//line templates/common.qtpl:19
- writesubhyphaeMatrix(qb422016, subhyphae)
-//line templates/common.qtpl:19
- qs422016 := string(qb422016.B)
-//line templates/common.qtpl:19
- qt422016.ReleaseByteBuffer(qb422016)
-//line templates/common.qtpl:19
- return qs422016
-//line templates/common.qtpl:19
-}
diff --git a/templates/auth.qtpl b/views/auth.qtpl
similarity index 100%
rename from templates/auth.qtpl
rename to views/auth.qtpl
diff --git a/templates/auth.qtpl.go b/views/auth.qtpl.go
similarity index 62%
rename from templates/auth.qtpl.go
rename to views/auth.qtpl.go
index 25bb21a..fec28c1 100644
--- a/templates/auth.qtpl.go
+++ b/views/auth.qtpl.go
@@ -1,36 +1,36 @@
// Code generated by qtc from "auth.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
-//line templates/auth.qtpl:1
-package templates
+//line views/auth.qtpl:1
+package views
-//line templates/auth.qtpl:1
+//line views/auth.qtpl:1
import "github.com/bouncepaw/mycorrhiza/user"
-//line templates/auth.qtpl:3
+//line views/auth.qtpl:3
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
-//line templates/auth.qtpl:3
+//line views/auth.qtpl:3
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
-//line templates/auth.qtpl:3
+//line views/auth.qtpl:3
func StreamLoginHTML(qw422016 *qt422016.Writer) {
-//line templates/auth.qtpl:3
+//line views/auth.qtpl:3
qw422016.N().S(`
`)
-//line templates/auth.qtpl:7
+//line views/auth.qtpl:7
if user.AuthUsed {
-//line templates/auth.qtpl:7
+//line views/auth.qtpl:7
qw422016.N().S(`
Login
`)
-//line templates/auth.qtpl:23
+//line views/auth.qtpl:23
} else {
-//line templates/auth.qtpl:23
+//line views/auth.qtpl:23
qw422016.N().S(`
Administrator of this wiki have not configured any authorization method. You can make edits anonymously.
← Go home
`)
-//line templates/auth.qtpl:26
+//line views/auth.qtpl:26
}
-//line templates/auth.qtpl:26
+//line views/auth.qtpl:26
qw422016.N().S(`
`)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
}
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
func WriteLoginHTML(qq422016 qtio422016.Writer) {
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
StreamLoginHTML(qw422016)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
qt422016.ReleaseWriter(qw422016)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
}
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
func LoginHTML() string {
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
WriteLoginHTML(qb422016)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
qs422016 := string(qb422016.B)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
return qs422016
-//line templates/auth.qtpl:30
+//line views/auth.qtpl:30
}
-//line templates/auth.qtpl:32
+//line views/auth.qtpl:32
func StreamLoginErrorHTML(qw422016 *qt422016.Writer, err string) {
-//line templates/auth.qtpl:32
+//line views/auth.qtpl:32
qw422016.N().S(`
`)
-//line templates/auth.qtpl:36
+//line views/auth.qtpl:36
switch err {
-//line templates/auth.qtpl:37
+//line views/auth.qtpl:37
case "unknown username":
-//line templates/auth.qtpl:37
+//line views/auth.qtpl:37
qw422016.N().S(`
Unknown username.
`)
-//line templates/auth.qtpl:39
+//line views/auth.qtpl:39
case "wrong password":
-//line templates/auth.qtpl:39
+//line views/auth.qtpl:39
qw422016.N().S(`
Wrong password.
`)
-//line templates/auth.qtpl:41
+//line views/auth.qtpl:41
default:
-//line templates/auth.qtpl:41
+//line views/auth.qtpl:41
qw422016.N().S(`
`)
-//line templates/auth.qtpl:42
+//line views/auth.qtpl:42
qw422016.E().S(err)
-//line templates/auth.qtpl:42
+//line views/auth.qtpl:42
qw422016.N().S(`
`)
-//line templates/auth.qtpl:43
+//line views/auth.qtpl:43
}
-//line templates/auth.qtpl:43
+//line views/auth.qtpl:43
qw422016.N().S(`
← Try again
`)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
}
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
func WriteLoginErrorHTML(qq422016 qtio422016.Writer, err string) {
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
StreamLoginErrorHTML(qw422016, err)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
qt422016.ReleaseWriter(qw422016)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
}
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
func LoginErrorHTML(err string) string {
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
WriteLoginErrorHTML(qb422016, err)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
qs422016 := string(qb422016.B)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
return qs422016
-//line templates/auth.qtpl:48
+//line views/auth.qtpl:48
}
-//line templates/auth.qtpl:50
+//line views/auth.qtpl:50
func StreamLogoutHTML(qw422016 *qt422016.Writer, can bool) {
-//line templates/auth.qtpl:50
+//line views/auth.qtpl:50
qw422016.N().S(`
`)
-//line templates/auth.qtpl:54
+//line views/auth.qtpl:54
if can {
-//line templates/auth.qtpl:54
+//line views/auth.qtpl:54
qw422016.N().S(`
Log out?
Confirm
Cancel
`)
-//line templates/auth.qtpl:58
+//line views/auth.qtpl:58
} else {
-//line templates/auth.qtpl:58
+//line views/auth.qtpl:58
qw422016.N().S(`
You cannot log out because you are not logged in.
Login
← Home
`)
-//line templates/auth.qtpl:62
+//line views/auth.qtpl:62
}
-//line templates/auth.qtpl:62
+//line views/auth.qtpl:62
qw422016.N().S(`
`)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
}
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
func WriteLogoutHTML(qq422016 qtio422016.Writer, can bool) {
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
StreamLogoutHTML(qw422016, can)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
qt422016.ReleaseWriter(qw422016)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
}
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
func LogoutHTML(can bool) string {
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
WriteLogoutHTML(qb422016, can)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
qs422016 := string(qb422016.B)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
return qs422016
-//line templates/auth.qtpl:66
+//line views/auth.qtpl:66
}
diff --git a/templates/mutators.qtpl b/views/mutators.qtpl
similarity index 91%
rename from templates/mutators.qtpl
rename to views/mutators.qtpl
index a90b767..233c3d5 100644
--- a/templates/mutators.qtpl
+++ b/views/mutators.qtpl
@@ -2,7 +2,7 @@
{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) %}
-{%s= navHTML(rq, hyphaName, "edit") %}
+{%s= NavHTML(rq, hyphaName, "edit") %}
Edit {%s util.BeautifulName(hyphaName) %}
@@ -20,10 +20,10 @@
{% endfunc %}
{% func PreviewHTML(rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) %}
-{%s= navHTML(rq, hyphaName, "edit") %}
+{%s= NavHTML(rq, hyphaName, "edit") %}
- Edit {%s hyphaName %} (preview)
+ Edit {%s util.BeautifulName(hyphaName) %} (preview)
{%s= warning %}