From 2211d2ef118c212bc31f956adc0058b4425dee7b Mon Sep 17 00:00:00 2001 From: Azareal Date: Wed, 19 Aug 2020 15:39:45 +1000 Subject: [PATCH] link forums page topics to last page --- public/member.js | 10 ++++------ routes/topic_list.go | 4 ++-- templates/forums.html | 5 +++-- templates/topic_poll.html | 2 +- templates/topics_topic.html | 6 +++--- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/public/member.js b/public/member.js index 9fb737d7..acfdeb67 100644 --- a/public/member.js +++ b/public/member.js @@ -153,10 +153,10 @@ var imageExts = ["png","jpg","jpe","jpeg","jif","jfi","jfif","svg","bmp","gif"," addInitHook("end_bind_topic", () => { log("in member.js end_bind_topic") - let changeListener = (files,handler) => { + let changeListener = (files,h) => { if(files!=null) { - files.removeEventListener("change", handler, false); - files.addEventListener("change", handler, false); + files.removeEventListener("change", h, false); + files.addEventListener("change", h, false); } }; let uploadFiles = document.getElementById("upload_files"); @@ -306,9 +306,7 @@ var imageExts = ["png","jpg","jpe","jpeg","jif","jfi","jfif","svg","bmp","gif"," data: JSON.stringify(selectedTopics), contentType: "application/json", error: ajaxError, - success: () => { - window.location.reload(); - } + success: () => window.location.reload() }); }; // TODO: Should we unbind this here to avoid binding multiple listeners to this accidentally? diff --git a/routes/topic_list.go b/routes/topic_list.go index f2bd4b74..fdf3b6c7 100644 --- a/routes/topic_list.go +++ b/routes/topic_list.go @@ -110,8 +110,8 @@ func TopicListCommon(w http.ResponseWriter, r *http.Request, user *c.User, h *c. var cfids []int if len(fids) > 0 { inSlice := func(haystack []int, needle int) bool { - for _, item := range haystack { - if needle == item { + for _, it := range haystack { + if needle == it { return true } } diff --git a/templates/forums.html b/templates/forums.html index edeac433..ff27af64 100644 --- a/templates/forums.html +++ b/templates/forums.html @@ -18,8 +18,9 @@ {{if .LastReplyer.MicroAvatar}}{{end}} - {{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}{{lang "forums_none"}}{{end}} - {{if .LastTopicTime}}
{{.LastTopicTime}}{{end}} + {{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}{{lang "forums_none"}}{{end}} + {{/**{{if .LastTopicTime}}
{{.LastTopicTime}}{{end}}**/}} +
{{.LastTopicTime}}
diff --git a/templates/topic_poll.html b/templates/topic_poll.html index f7f0b4fd..84466966 100644 --- a/templates/topic_poll.html +++ b/templates/topic_poll.html @@ -1,5 +1,5 @@
-
+
{{range .Poll.QuickOptions}}
diff --git a/templates/topics_topic.html b/templates/topics_topic.html index 421c3e45..d97d5414 100644 --- a/templates/topics_topic.html +++ b/templates/topics_topic.html @@ -1,7 +1,7 @@ -
+
- + {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}}
{{.Creator.Name}} @@ -24,7 +24,7 @@