diff --git a/http_admin.go b/http_admin.go
index cd3675d..2b20fb5 100644
--- a/http_admin.go
+++ b/http_admin.go
@@ -4,8 +4,8 @@ import (
"log"
"net/http"
- "github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
+ "github.com/bouncepaw/mycorrhiza/views"
)
// This is not init(), because user.AuthUsed is not set at init-stage.
@@ -21,7 +21,7 @@ func handlerAdmin(w http.ResponseWriter, rq *http.Request) {
if user.CanProceed(rq, "admin") {
w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK)
- w.Write([]byte(base("Admin panel", templates.AdminPanelHTML(), user.FromRequest(rq))))
+ w.Write([]byte(base("Admin panel", views.AdminPanelHTML(), user.FromRequest(rq))))
}
}
diff --git a/http_readers.go b/http_readers.go
index 119704b..b7711c6 100644
--- a/http_readers.go
+++ b/http_readers.go
@@ -13,7 +13,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/markup"
"github.com/bouncepaw/mycorrhiza/mimetype"
- "github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
@@ -99,7 +98,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
}
}
util.HTTP200Page(w,
- templates.BaseHTML(
+ views.BaseHTML(
util.BeautifulName(hyphaName),
views.HyphaHTML(rq, h, contents),
u,
diff --git a/main.go b/main.go
index e36233d..88c9d1a 100644
--- a/main.go
+++ b/main.go
@@ -20,6 +20,7 @@ import (
"github.com/bouncepaw/mycorrhiza/templates"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
+ "github.com/bouncepaw/mycorrhiza/views"
)
// WikiDir is a rooted path to the wiki storage directory.
@@ -53,13 +54,13 @@ func handlerList(w http.ResponseWriter, rq *http.Request) {
u = user.FromRequest(rq)
)
for h := range hyphae.YieldExistingHyphae() {
- tbody += templates.HyphaListRowHTML(h.Name, mimetype.FromExtension(filepath.Ext(h.BinaryPath)), h.BinaryPath != "")
+ tbody += views.HyphaListRowHTML(h.Name, mimetype.FromExtension(filepath.Ext(h.BinaryPath)), h.BinaryPath != "")
}
- util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount), u))
+ util.HTTP200Page(w, base("List of pages", views.HyphaListHTML(tbody, pageCount), u))
}
// This part is present in all html documents.
-var base = templates.BaseHTML
+var base = views.BaseHTML
// Reindex all hyphae by checking the wiki storage directory anew.
func handlerReindex(w http.ResponseWriter, rq *http.Request) {
@@ -148,13 +149,13 @@ func handlerIcon(w http.ResponseWriter, rq *http.Request) {
func handlerAbout(w http.ResponseWriter, rq *http.Request) {
w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK)
- w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML(), user.FromRequest(rq))))
+ w.Write([]byte(base("About "+util.SiteName, views.AboutHTML(), user.FromRequest(rq))))
}
func handlerUserList(w http.ResponseWriter, rq *http.Request) {
w.Header().Set("Content-Type", "text/html;charset=utf-8")
w.WriteHeader(http.StatusOK)
- w.Write([]byte(base("User list", templates.UserListHTML(), user.FromRequest(rq))))
+ w.Write([]byte(base("User list", views.UserListHTML(), user.FromRequest(rq))))
}
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {
diff --git a/templates/admin.qtpl b/templates/admin.qtpl
deleted file mode 100644
index 8932da7..0000000
--- a/templates/admin.qtpl
+++ /dev/null
@@ -1,30 +0,0 @@
-{% func AdminPanelHTML() %}
-
-
- Admininstrative functions
-
-
-
-
-{% endfunc %}
diff --git a/templates/admin.qtpl.go b/templates/admin.qtpl.go
deleted file mode 100644
index c017c8d..0000000
--- a/templates/admin.qtpl.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Code generated by qtc from "admin.qtpl". DO NOT EDIT.
-// See https://github.com/valyala/quicktemplate for details.
-
-//line templates/admin.qtpl:1
-package templates
-
-//line templates/admin.qtpl:1
-import (
- qtio422016 "io"
-
- qt422016 "github.com/valyala/quicktemplate"
-)
-
-//line templates/admin.qtpl:1
-var (
- _ = qtio422016.Copy
- _ = qt422016.AcquireByteBuffer
-)
-
-//line templates/admin.qtpl:1
-func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
-//line templates/admin.qtpl:1
- qw422016.N().S(`
-
-
- Admininstrative functions
-
-
-
-
-`)
-//line templates/admin.qtpl:30
-}
-
-//line templates/admin.qtpl:30
-func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
-//line templates/admin.qtpl:30
- qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/admin.qtpl:30
- StreamAdminPanelHTML(qw422016)
-//line templates/admin.qtpl:30
- qt422016.ReleaseWriter(qw422016)
-//line templates/admin.qtpl:30
-}
-
-//line templates/admin.qtpl:30
-func AdminPanelHTML() string {
-//line templates/admin.qtpl:30
- qb422016 := qt422016.AcquireByteBuffer()
-//line templates/admin.qtpl:30
- WriteAdminPanelHTML(qb422016)
-//line templates/admin.qtpl:30
- qs422016 := string(qb422016.B)
-//line templates/admin.qtpl:30
- qt422016.ReleaseByteBuffer(qb422016)
-//line templates/admin.qtpl:30
- return qs422016
-//line templates/admin.qtpl:30
-}
diff --git a/templates/stuff.qtpl b/views/stuff.qtpl
similarity index 80%
rename from templates/stuff.qtpl
rename to views/stuff.qtpl
index f6f95b8..fed2faa 100644
--- a/templates/stuff.qtpl
+++ b/views/stuff.qtpl
@@ -6,6 +6,7 @@
+
{%s title %}
{% for _, el := range headElements %}{%s= el %}{% endfor %}
@@ -17,7 +18,7 @@
{%- for _, link := range util.HeaderLinks -%}
{%- endfor -%}
- {%s= userMenuHTML(u) %}
+ {%s= UserMenuHTML(u) %}
@@ -123,3 +124,34 @@ for u := range user.YieldUsers() {
{% endfunc %}
+
+{% func AdminPanelHTML() %}
+
+
+ Admininstrative functions
+
+
+
+
+{% endfunc %}
diff --git a/templates/stuff.qtpl.go b/views/stuff.qtpl.go
similarity index 52%
rename from templates/stuff.qtpl.go
rename to views/stuff.qtpl.go
index d6efabd..7c63324 100644
--- a/templates/stuff.qtpl.go
+++ b/views/stuff.qtpl.go
@@ -1,50 +1,51 @@
// Code generated by qtc from "stuff.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
-//line templates/stuff.qtpl:1
-package templates
+//line views/stuff.qtpl:1
+package views
-//line templates/stuff.qtpl:1
+//line views/stuff.qtpl:1
import "github.com/bouncepaw/mycorrhiza/util"
-//line templates/stuff.qtpl:2
+//line views/stuff.qtpl:2
import "github.com/bouncepaw/mycorrhiza/user"
-//line templates/stuff.qtpl:4
+//line views/stuff.qtpl:4
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
-//line templates/stuff.qtpl:4
+//line views/stuff.qtpl:4
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
-//line templates/stuff.qtpl:4
+//line views/stuff.qtpl:4
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) {
-//line templates/stuff.qtpl:4
+//line views/stuff.qtpl:4
qw422016.N().S(`
+
`)
-//line templates/stuff.qtpl:10
+//line views/stuff.qtpl:11
qw422016.E().S(title)
-//line templates/stuff.qtpl:10
+//line views/stuff.qtpl:11
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:11
+//line views/stuff.qtpl:12
for _, el := range headElements {
-//line templates/stuff.qtpl:11
+//line views/stuff.qtpl:12
qw422016.N().S(el)
-//line templates/stuff.qtpl:11
+//line views/stuff.qtpl:12
}
-//line templates/stuff.qtpl:11
+//line views/stuff.qtpl:12
qw422016.N().S(`
@@ -52,76 +53,76 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User,
`)
-//line templates/stuff.qtpl:24
+//line views/stuff.qtpl:25
qw422016.N().S(body)
-//line templates/stuff.qtpl:24
+//line views/stuff.qtpl:25
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
}
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) {
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
StreamBaseHTML(qw422016, title, body, u, headElements...)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
qt422016.ReleaseWriter(qw422016)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
}
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
func BaseHTML(title, body string, u *user.User, headElements ...string) string {
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
WriteBaseHTML(qb422016, title, body, u, headElements...)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
qs422016 := string(qb422016.B)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
return qs422016
-//line templates/stuff.qtpl:27
+//line views/stuff.qtpl:28
}
-//line templates/stuff.qtpl:29
+//line views/stuff.qtpl:30
func StreamUserListHTML(qw422016 *qt422016.Writer) {
-//line templates/stuff.qtpl:29
+//line views/stuff.qtpl:30
qw422016.N().S(`
List of users
`)
-//line templates/stuff.qtpl:34
+//line views/stuff.qtpl:35
var (
admins = make([]string, 0)
moderators = make([]string, 0)
@@ -138,129 +139,129 @@ func StreamUserListHTML(qw422016 *qt422016.Writer) {
}
}
-//line templates/stuff.qtpl:49
+//line views/stuff.qtpl:50
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
}
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
func WriteUserListHTML(qq422016 qtio422016.Writer) {
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
StreamUserListHTML(qw422016)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
qt422016.ReleaseWriter(qw422016)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
}
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
func UserListHTML() string {
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
WriteUserListHTML(qb422016)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
qs422016 := string(qb422016.B)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
return qs422016
-//line templates/stuff.qtpl:70
+//line views/stuff.qtpl:71
}
-//line templates/stuff.qtpl:72
+//line views/stuff.qtpl:73
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
-//line templates/stuff.qtpl:72
+//line views/stuff.qtpl:73
qw422016.N().S(`
List of hyphae
This wiki has `)
-//line templates/stuff.qtpl:76
+//line views/stuff.qtpl:77
qw422016.N().D(pageCount)
-//line templates/stuff.qtpl:76
+//line views/stuff.qtpl:77
qw422016.N().S(` hyphae.
@@ -271,206 +272,268 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int)
`)
-//line templates/stuff.qtpl:85
+//line views/stuff.qtpl:86
qw422016.N().S(tbody)
-//line templates/stuff.qtpl:85
+//line views/stuff.qtpl:86
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
}
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
StreamHyphaListHTML(qw422016, tbody, pageCount)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
qt422016.ReleaseWriter(qw422016)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
}
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
func HyphaListHTML(tbody string, pageCount int) string {
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
WriteHyphaListHTML(qb422016, tbody, pageCount)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
qs422016 := string(qb422016.B)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
return qs422016
-//line templates/stuff.qtpl:90
+//line views/stuff.qtpl:91
}
-//line templates/stuff.qtpl:92
+//line views/stuff.qtpl:93
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
-//line templates/stuff.qtpl:92
+//line views/stuff.qtpl:93
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:94
+//line views/stuff.qtpl:95
qw422016.E().S(hyphaName)
-//line templates/stuff.qtpl:94
+//line views/stuff.qtpl:95
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:95
+//line views/stuff.qtpl:96
if binaryPresent {
-//line templates/stuff.qtpl:95
+//line views/stuff.qtpl:96
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:96
+//line views/stuff.qtpl:97
qw422016.E().S(binaryMime)
-//line templates/stuff.qtpl:96
+//line views/stuff.qtpl:97
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:97
+//line views/stuff.qtpl:98
} else {
-//line templates/stuff.qtpl:97
+//line views/stuff.qtpl:98
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:99
+//line views/stuff.qtpl:100
}
-//line templates/stuff.qtpl:99
+//line views/stuff.qtpl:100
qw422016.N().S(`
`)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
}
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
qt422016.ReleaseWriter(qw422016)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
}
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
qs422016 := string(qb422016.B)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
return qs422016
-//line templates/stuff.qtpl:101
+//line views/stuff.qtpl:102
}
-//line templates/stuff.qtpl:103
+//line views/stuff.qtpl:104
func StreamAboutHTML(qw422016 *qt422016.Writer) {
-//line templates/stuff.qtpl:103
+//line views/stuff.qtpl:104
qw422016.N().S(`
About `)
-//line templates/stuff.qtpl:107
+//line views/stuff.qtpl:108
qw422016.E().S(util.SiteName)
-//line templates/stuff.qtpl:107
+//line views/stuff.qtpl:108
qw422016.N().S(`
See /list for information about hyphae on this wiki.
`)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
}
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
func WriteAboutHTML(qq422016 qtio422016.Writer) {
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
qw422016 := qt422016.AcquireWriter(qq422016)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
StreamAboutHTML(qw422016)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
qt422016.ReleaseWriter(qw422016)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
}
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
func AboutHTML() string {
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
qb422016 := qt422016.AcquireByteBuffer()
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
WriteAboutHTML(qb422016)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
qs422016 := string(qb422016.B)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
qt422016.ReleaseByteBuffer(qb422016)
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
return qs422016
-//line templates/stuff.qtpl:125
+//line views/stuff.qtpl:126
+}
+
+//line views/stuff.qtpl:128
+func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
+//line views/stuff.qtpl:128
+ qw422016.N().S(`
+
+
+ Admininstrative functions
+
+
+
+
+`)
+//line views/stuff.qtpl:157
+}
+
+//line views/stuff.qtpl:157
+func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
+//line views/stuff.qtpl:157
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line views/stuff.qtpl:157
+ StreamAdminPanelHTML(qw422016)
+//line views/stuff.qtpl:157
+ qt422016.ReleaseWriter(qw422016)
+//line views/stuff.qtpl:157
+}
+
+//line views/stuff.qtpl:157
+func AdminPanelHTML() string {
+//line views/stuff.qtpl:157
+ qb422016 := qt422016.AcquireByteBuffer()
+//line views/stuff.qtpl:157
+ WriteAdminPanelHTML(qb422016)
+//line views/stuff.qtpl:157
+ qs422016 := string(qb422016.B)
+//line views/stuff.qtpl:157
+ qt422016.ReleaseByteBuffer(qb422016)
+//line views/stuff.qtpl:157
+ return qs422016
+//line views/stuff.qtpl:157
}