diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..e2c07cf
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/assets.qtpl.go b/assets/assets.qtpl.go
index 4877da2..aef5d36 100644
--- a/assets/assets.qtpl.go
+++ b/assets/assets.qtpl.go
@@ -113,9 +113,14 @@ func StreamDefaultCSS(qw422016 *qt422016.Writer) {
qw422016.N().S(`
`)
//line assets/assets.qtpl:10
- qw422016.N().S(`
+ qw422016.N().S(`.non-existent-hypha { }
+.non-existent-hypha__ways { display: flex; flex-direction: column; width: 100%; margin: 0 0 1rem 0;}
+.non-existent-hypha__way { border: 1px #999 solid; border-radius: .25rem; padding: .25rem; }
+.non-existent-hypha__title { margin-bottom: 1rem; }
+.non-existent-hypha__subtitle { margin: 0; }
+
.amnt-grid { display: grid; grid-template-columns: 1fr 1fr; }
-.upload-binary__input { display: block; margin: .25rem 0; }
+#upload-binary__input { display: block; margin: .25rem 0 .5rem 0; }
.modal__title { font-size: 2rem; }
.modal__title_small { font-size: 1.5rem; }
@@ -157,6 +162,12 @@ header { width: 100%; margin-bottom: 1rem; }
main { padding: 1rem; margin: 0; }
}
+@media screen and (min-width: 500px) {
+ .non-existent-hypha__way { flex: 1; margin-right: .5rem; }
+ .non-existent-hypha__ways { flex-direction: row; }
+ .non-existent-hypha__way:last-child { margin-right: 0; }
+}
+
/* No longer a phone but still small screen: draw normal tabs, center main */
@media screen and (min-width: 801px) {
.main-width { padding: 1rem 2rem; width: 800px; margin: 0 auto; }
@@ -310,8 +321,13 @@ caption { caption-side: top; font-size: small; }
.relative-hyphae__link { text-decoration: none; display: block; padding: .25rem .5rem; }
+.btn { display: inline-block; border: 1px #999 solid; border-radius: .25rem; text-decoration: none; padding: .25rem; font-size: 1rem; }
+
/* Color stuff */
/* Lighter stuff #eee */
+.btn { background-color: #eee; color: black; }
+.btn:visited { color: black; }
+
article code,
article .codeblock,
.transclusion,
@@ -394,6 +410,7 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
@media screen and (max-width: 800px) {
.hypha-tabs { background-color: #232323; }
}
+ .btn { background-color: #ddd; color: black; }
}
diff --git a/assets/default.css b/assets/default.css
index 96d6791..24f0a24 100644
--- a/assets/default.css
+++ b/assets/default.css
@@ -1,6 +1,11 @@
+.non-existent-hypha { }
+.non-existent-hypha__ways { display: flex; flex-direction: column; width: 100%; margin: 0 0 1rem 0;}
+.non-existent-hypha__way { border: 1px #999 solid; border-radius: .25rem; padding: .25rem; }
+.non-existent-hypha__title { margin-bottom: 1rem; }
+.non-existent-hypha__subtitle { margin: 0; }
.amnt-grid { display: grid; grid-template-columns: 1fr 1fr; }
-.upload-binary__input { display: block; margin: .25rem 0; }
+#upload-binary__input { display: block; margin: .25rem 0 .5rem 0; }
.modal__title { font-size: 2rem; }
.modal__title_small { font-size: 1.5rem; }
@@ -42,6 +47,12 @@ header { width: 100%; margin-bottom: 1rem; }
main { padding: 1rem; margin: 0; }
}
+@media screen and (min-width: 500px) {
+ .non-existent-hypha__way { flex: 1; margin-right: .5rem; }
+ .non-existent-hypha__ways { flex-direction: row; }
+ .non-existent-hypha__way:last-child { margin-right: 0; }
+}
+
/* No longer a phone but still small screen: draw normal tabs, center main */
@media screen and (min-width: 801px) {
.main-width { padding: 1rem 2rem; width: 800px; margin: 0 auto; }
@@ -195,8 +206,13 @@ caption { caption-side: top; font-size: small; }
.relative-hyphae__link { text-decoration: none; display: block; padding: .25rem .5rem; }
+.btn { display: inline-block; border: 1px #999 solid; border-radius: .25rem; text-decoration: none; padding: .25rem; font-size: 1rem; }
+
/* Color stuff */
/* Lighter stuff #eee */
+.btn { background-color: #eee; color: black; }
+.btn:visited { color: black; }
+
article code,
article .codeblock,
.transclusion,
@@ -279,6 +295,7 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
@media screen and (max-width: 800px) {
.hypha-tabs { background-color: #232323; }
}
+ .btn { background-color: #ddd; color: black; }
}
diff --git a/views/hypha.qtpl b/views/hypha.qtpl
index b6d5f77..e514fdd 100644
--- a/views/hypha.qtpl
+++ b/views/hypha.qtpl
@@ -1,9 +1,47 @@
{% import "path/filepath" %}
{% import "strings" %}
+
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
+{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
+{% func nonExistentHyphaNotice(h *hyphae.Hypha, u *user.User) %}
+
+ This hypha does not exist
+ {% if user.AuthUsed && u.Group == "anon" %}
+ You are not authorized to create new hyphae. Here is what you can do:
+
+ {% else %}
+
+
+
+ 📝 Write a text
+ Write a note, a diary, an article, a story or anything textual using Mycomarkup .
+ Make sure to follow this wiki's writing conventions if there are any.
+ Create
+
+
+
+ 🖼 Upload a media
+ Upload a picture, a video or an audio. Most common formats can be accessed from the browser, others can be only downloaded afterwards. You can write a description for the media later.
+
+
+
+ {% endif %}
+
+{% endfunc %}
+
{% func NaviTitleHTML(h *hyphae.Hypha) %}
{% code
var (
diff --git a/views/hypha.qtpl.go b/views/hypha.qtpl.go
index 9f6ad65..24824d3 100644
--- a/views/hypha.qtpl.go
+++ b/views/hypha.qtpl.go
@@ -10,227 +10,325 @@ import "path/filepath"
//line views/hypha.qtpl:2
import "strings"
-//line views/hypha.qtpl:3
+//line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/cfg"
-//line views/hypha.qtpl:4
+//line views/hypha.qtpl:5
import "github.com/bouncepaw/mycorrhiza/hyphae"
-//line views/hypha.qtpl:5
-import "github.com/bouncepaw/mycorrhiza/util"
+//line views/hypha.qtpl:6
+import "github.com/bouncepaw/mycorrhiza/user"
//line views/hypha.qtpl:7
+import "github.com/bouncepaw/mycorrhiza/util"
+
+//line views/hypha.qtpl:9
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
-//line views/hypha.qtpl:7
+//line views/hypha.qtpl:9
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
-//line views/hypha.qtpl:7
+//line views/hypha.qtpl:9
+func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h *hyphae.Hypha, u *user.User) {
+//line views/hypha.qtpl:9
+ qw422016.N().S(`
+
+ This hypha does not exist
+ `)
+//line views/hypha.qtpl:12
+ if user.AuthUsed && u.Group == "anon" {
+//line views/hypha.qtpl:12
+ qw422016.N().S(`
+ You are not authorized to create new hyphae. Here is what you can do:
+
+ `)
+//line views/hypha.qtpl:18
+ } else {
+//line views/hypha.qtpl:18
+ qw422016.N().S(`
+
+
+
+ 📝 Write a text
+ Write a note, a diary, an article, a story or anything textual using Mycomarkup .
+ Make sure to follow this wiki's writing conventions if there are any.
+ Create
+
+
+
+ 🖼 Upload a media
+ Upload a picture, a video or an audio. Most common formats can be accessed from the browser, others can be only downloaded afterwards. You can write a description for the media later.
+
+
+
+ `)
+//line views/hypha.qtpl:41
+ }
+//line views/hypha.qtpl:41
+ qw422016.N().S(`
+
+`)
+//line views/hypha.qtpl:43
+}
+
+//line views/hypha.qtpl:43
+func writenonExistentHyphaNotice(qq422016 qtio422016.Writer, h *hyphae.Hypha, u *user.User) {
+//line views/hypha.qtpl:43
+ qw422016 := qt422016.AcquireWriter(qq422016)
+//line views/hypha.qtpl:43
+ streamnonExistentHyphaNotice(qw422016, h, u)
+//line views/hypha.qtpl:43
+ qt422016.ReleaseWriter(qw422016)
+//line views/hypha.qtpl:43
+}
+
+//line views/hypha.qtpl:43
+func nonExistentHyphaNotice(h *hyphae.Hypha, u *user.User) string {
+//line views/hypha.qtpl:43
+ qb422016 := qt422016.AcquireByteBuffer()
+//line views/hypha.qtpl:43
+ writenonExistentHyphaNotice(qb422016, h, u)
+//line views/hypha.qtpl:43
+ qs422016 := string(qb422016.B)
+//line views/hypha.qtpl:43
+ qt422016.ReleaseByteBuffer(qb422016)
+//line views/hypha.qtpl:43
+ return qs422016
+//line views/hypha.qtpl:43
+}
+
+//line views/hypha.qtpl:45
func StreamNaviTitleHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
-//line views/hypha.qtpl:7
+//line views/hypha.qtpl:45
qw422016.N().S(`
`)
-//line views/hypha.qtpl:9
+//line views/hypha.qtpl:47
var (
prevAcc = "/hypha/"
parts = strings.Split(h.Name, "/")
)
-//line views/hypha.qtpl:13
+//line views/hypha.qtpl:51
qw422016.N().S(`
`)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
}
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
func WriteNaviTitleHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
StreamNaviTitleHTML(qw422016, h)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
qt422016.ReleaseWriter(qw422016)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
}
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
func NaviTitleHTML(h *hyphae.Hypha) string {
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
qb422016 := qt422016.AcquireByteBuffer()
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
WriteNaviTitleHTML(qb422016, h)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
qs422016 := string(qb422016.B)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
qt422016.ReleaseByteBuffer(qb422016)
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
return qs422016
-//line views/hypha.qtpl:33
+//line views/hypha.qtpl:71
}
-//line views/hypha.qtpl:35
+//line views/hypha.qtpl:73
func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
-//line views/hypha.qtpl:35
+//line views/hypha.qtpl:73
qw422016.N().S(`
`)
-//line views/hypha.qtpl:36
+//line views/hypha.qtpl:74
switch filepath.Ext(h.BinaryPath) {
-//line views/hypha.qtpl:38
+//line views/hypha.qtpl:76
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
-//line views/hypha.qtpl:38
+//line views/hypha.qtpl:76
qw422016.N().S(`
`)
-//line views/hypha.qtpl:43
+//line views/hypha.qtpl:81
case ".ogg", ".webm", ".mp4":
-//line views/hypha.qtpl:43
+//line views/hypha.qtpl:81
qw422016.N().S(`
`)
-//line views/hypha.qtpl:51
+//line views/hypha.qtpl:89
case ".mp3":
-//line views/hypha.qtpl:51
+//line views/hypha.qtpl:89
qw422016.N().S(`
`)
-//line views/hypha.qtpl:59
+//line views/hypha.qtpl:97
default:
-//line views/hypha.qtpl:59
+//line views/hypha.qtpl:97
qw422016.N().S(`
`)
-//line views/hypha.qtpl:63
+//line views/hypha.qtpl:101
}
-//line views/hypha.qtpl:63
+//line views/hypha.qtpl:101
qw422016.N().S(`
`)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
}
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
func WriteAttachmentHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
StreamAttachmentHTML(qw422016, h)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
qt422016.ReleaseWriter(qw422016)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
}
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
func AttachmentHTML(h *hyphae.Hypha) string {
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
qb422016 := qt422016.AcquireByteBuffer()
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
WriteAttachmentHTML(qb422016, h)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
qs422016 := string(qb422016.B)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
qt422016.ReleaseByteBuffer(qb422016)
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
return qs422016
-//line views/hypha.qtpl:64
+//line views/hypha.qtpl:102
}
diff --git a/views/readers.qtpl b/views/readers.qtpl
index cf7c478..22c4ac8 100644
--- a/views/readers.qtpl
+++ b/views/readers.qtpl
@@ -75,26 +75,17 @@ If `contents` == "", a helpful message is shown instead.
{% func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) %}
{% code
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
+ u := user.FromRequest(rq)
%}
{%= NavHTML(rq, h.Name, "page") %}
{%s= NaviTitleHTML(h) %}
- {% if contents == "" %}
- This hypha has no text. Why not create it ?
- {% if u := user.FromRequest(rq); (!user.AuthUsed || u.Group != "anon") && !h.Exists %}
-
-
- {% endif %}
- {% else %}
+ {% if h.Exists %}
{%s= contents %}
+ {% else %}
+ {%= nonExistentHyphaNotice(h, u) %}
{% endif %}
diff --git a/views/readers.qtpl.go b/views/readers.qtpl.go
index ef9c851..bba5bba 100644
--- a/views/readers.qtpl.go
+++ b/views/readers.qtpl.go
@@ -230,220 +230,199 @@ func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hyph
`)
//line views/readers.qtpl:77
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
+ u := user.FromRequest(rq)
-//line views/readers.qtpl:78
+//line views/readers.qtpl:79
qw422016.N().S(`
`)
-//line views/readers.qtpl:79
+//line views/readers.qtpl:80
StreamNavHTML(qw422016, rq, h.Name, "page")
-//line views/readers.qtpl:79
+//line views/readers.qtpl:80
qw422016.N().S(`
`)
-//line views/readers.qtpl:83
+//line views/readers.qtpl:84
qw422016.N().S(NaviTitleHTML(h))
-//line views/readers.qtpl:83
+//line views/readers.qtpl:84
qw422016.N().S(`
`)
-//line views/readers.qtpl:84
- if contents == "" {
-//line views/readers.qtpl:84
- qw422016.N().S(`
- This hypha has no text. Why not create it ?
- `)
-//line views/readers.qtpl:86
- if u := user.FromRequest(rq); (!user.AuthUsed || u.Group != "anon") && !h.Exists {
-//line views/readers.qtpl:86
- qw422016.N().S(`
-
-
- `)
-//line views/readers.qtpl:95
- }
-//line views/readers.qtpl:95
- qw422016.N().S(`
- `)
-//line views/readers.qtpl:96
- } else {
-//line views/readers.qtpl:96
qw422016.N().S(`
`)
-//line views/readers.qtpl:97
+//line views/readers.qtpl:86
qw422016.N().S(contents)
-//line views/readers.qtpl:97
+//line views/readers.qtpl:86
qw422016.N().S(`
`)
-//line views/readers.qtpl:98
+//line views/readers.qtpl:87
+ } else {
+//line views/readers.qtpl:87
+ qw422016.N().S(`
+ `)
+//line views/readers.qtpl:88
+ streamnonExistentHyphaNotice(qw422016, h, u)
+//line views/readers.qtpl:88
+ qw422016.N().S(`
+ `)
+//line views/readers.qtpl:89
}
-//line views/readers.qtpl:98
+//line views/readers.qtpl:89
qw422016.N().S(`
`)
-//line views/readers.qtpl:108
+//line views/readers.qtpl:99
StreamSubhyphaeHTML(qw422016, subhyphae)
-//line views/readers.qtpl:108
+//line views/readers.qtpl:99
qw422016.N().S(`
`)
-//line views/readers.qtpl:110
+//line views/readers.qtpl:101
StreamRelativeHyphaeHTML(qw422016, relatives)
-//line views/readers.qtpl:110
+//line views/readers.qtpl:101
qw422016.N().S(`
`)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
}
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
func WriteHyphaHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
StreamHyphaHTML(qw422016, rq, h, contents)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
qt422016.ReleaseWriter(qw422016)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
}
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) string {
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
qb422016 := qt422016.AcquireByteBuffer()
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
WriteHyphaHTML(qb422016, rq, h, contents)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
qs422016 := string(qb422016.B)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
qt422016.ReleaseByteBuffer(qb422016)
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
return qs422016
-//line views/readers.qtpl:112
+//line views/readers.qtpl:103
}
-//line views/readers.qtpl:114
+//line views/readers.qtpl:105
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
-//line views/readers.qtpl:114
+//line views/readers.qtpl:105
qw422016.N().S(`
`)
-//line views/readers.qtpl:116
+//line views/readers.qtpl:107
relatives, subhyphae, _, _ := tree.Tree(h.Name)
-//line views/readers.qtpl:117
+//line views/readers.qtpl:108
qw422016.N().S(`
`)
-//line views/readers.qtpl:118
+//line views/readers.qtpl:109
StreamNavHTML(qw422016, rq, h.Name, "revision", revHash)
-//line views/readers.qtpl:118
+//line views/readers.qtpl:109
qw422016.N().S(`
Please note that viewing binary parts of hyphae is not supported in history for now.
`)
-//line views/readers.qtpl:123
+//line views/readers.qtpl:114
qw422016.N().S(NaviTitleHTML(h))
-//line views/readers.qtpl:123
+//line views/readers.qtpl:114
qw422016.N().S(`
`)
-//line views/readers.qtpl:124
+//line views/readers.qtpl:115
qw422016.N().S(contents)
-//line views/readers.qtpl:124
+//line views/readers.qtpl:115
qw422016.N().S(`
`)
-//line views/readers.qtpl:126
+//line views/readers.qtpl:117
StreamSubhyphaeHTML(qw422016, subhyphae)
-//line views/readers.qtpl:126
+//line views/readers.qtpl:117
qw422016.N().S(`
`)
-//line views/readers.qtpl:128
+//line views/readers.qtpl:119
StreamRelativeHyphaeHTML(qw422016, relatives)
-//line views/readers.qtpl:128
+//line views/readers.qtpl:119
qw422016.N().S(`
`)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
}
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
qw422016 := qt422016.AcquireWriter(qq422016)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
StreamRevisionHTML(qw422016, rq, h, contents, revHash)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
qt422016.ReleaseWriter(qw422016)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
}
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, revHash string) string {
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
qb422016 := qt422016.AcquireByteBuffer()
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
WriteRevisionHTML(qb422016, rq, h, contents, revHash)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
qs422016 := string(qb422016.B)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
qt422016.ReleaseByteBuffer(qb422016)
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
return qs422016
-//line views/readers.qtpl:130
+//line views/readers.qtpl:121
}