From dc974cf72b9a36a70604b0c0ede3c718fe8f85a8 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 8 Dec 2018 16:49:14 +1000 Subject: [PATCH] Improved mobile usability for Nox in the topic list, profiles, account manager and control panel. More to come. Fixed a bug in the template generator where fragment indices would sometimes become negative. Forum pages are now considered to be part of /forums/ instead of /topics/ in the menu tab highlighter. Fixed a bug in the forum page in Nox where the forum options weren't aligned to the right. Switched out a couple of {{if ne .CurrentUser.ID 0}}s for {{if .CurrentUser.Loggedin}}s Moved the filter opt separator into it's own DOM node for easier styling. Added the quick_topic.create_topic_button_short phrase. Added the topic_list.moderate_short phrase. --- common/templates/templates.go | 7 ++++++- langs/english.json | 2 ++ routes/forum.go | 1 + templates/forum.html | 3 ++- templates/topics.html | 5 +++-- themes/nox/public/acc_panel_common.css | 9 +++++++++ themes/nox/public/main.css | 18 +++++++++++++++--- themes/nox/public/panel.css | 8 ++++++++ themes/nox/public/profile.css | 13 +++++++++++++ 9 files changed, 59 insertions(+), 7 deletions(-) diff --git a/common/templates/templates.go b/common/templates/templates.go index 6c25bcee..828780a9 100644 --- a/common/templates/templates.go +++ b/common/templates/templates.go @@ -377,6 +377,7 @@ func (c *CTemplateSet) compile(name string, content, expects string, expectsInt c.detail("invisible") continue } + // TODO: What if the same template is invoked in multiple spots in a template? skipBlock := skipped[frag.TemplateName] skip := skipBlock.Frags[skipBlock.ClosestFragSkip] _, ok := skipBlock.Frags[frag.Index] @@ -385,7 +386,11 @@ func (c *CTemplateSet) compile(name string, content, expects string, expectsInt } c.detailf("skipblock %+v\n", skipBlock) c.detail("skipping ", skip) - writeFrag(frag.TemplateName, frag.Index-skip, frag.Body) + index := frag.Index - skip + if index < 0 { + index = 0 + } + writeFrag(frag.TemplateName, index, frag.Body) } fout = strings.Replace(fout, `)) diff --git a/langs/english.json b/langs/english.json index 59916a62..dda4308a 100644 --- a/langs/english.json +++ b/langs/english.json @@ -499,6 +499,7 @@ "quick_topic.content_placeholder":"Insert post here", "quick_topic.add_poll_option":"Add new poll option", "quick_topic.create_topic_button":"Create Topic", + "quick_topic.create_topic_button_short":"New Topic", "quick_topic.add_poll_button":"Add Poll", "quick_topic.add_file_button":"Add File", "quick_topic.cancel_button":"Cancel", @@ -506,6 +507,7 @@ "topic_list.create_topic_tooltip":"Create Topic", "topic_list.create_topic_aria":"Create a topic", "topic_list.moderate":"Moderate", + "topic_list.moderate_short":"Mod", "topic_list.moderate_tooltip":"Moderate", "topic_list.moderate_aria":"Moderate Posts", "topic_list.what_to_do":"What do you want to do with these {0} topics?", diff --git a/routes/forum.go b/routes/forum.go index affaa234..3e639a46 100644 --- a/routes/forum.go +++ b/routes/forum.go @@ -42,6 +42,7 @@ func ViewForum(w http.ResponseWriter, r *http.Request, user common.User, header return common.NoPermissions(w, r, user) } header.Zone = "view_forum" + header.Path = "/forums/" // TODO: Fix this double-check forum, err := common.Forums.Get(fid) diff --git a/templates/forum.html b/templates/forum.html index db148a3b..a5e16fd2 100644 --- a/templates/forum.html +++ b/templates/forum.html @@ -4,13 +4,14 @@ {{if ne .LastPage .Page}}
{{end}}
-
+

{{.Title}}

{{if .CurrentUser.Loggedin}}
{{if .CurrentUser.Perms.CreateTopic}} +
{{/** TODO: Add a permissions check for this **/}} diff --git a/templates/topics.html b/templates/topics.html index 15304696..be90c760 100644 --- a/templates/topics.html +++ b/templates/topics.html @@ -1,13 +1,14 @@ {{template "header.html" . }}
-
+

{{lang "topics_head"}}

{{if .CurrentUser.Loggedin}}
{{if .ForumList}}
- / {{if eq .Sort.SortBy "mostviewed" }}{{lang "topic_list.most_viewed_filter"}}{{else}}{{lang "topic_list.most_recent_filter"}}{{end}} + / + {{if eq .Sort.SortBy "mostviewed" }}{{lang "topic_list.most_viewed_filter"}}{{else}}{{lang "topic_list.most_recent_filter"}}{{end}}