Show an inline error when there aren't any topics instead of a 404.

Use a non-breaking space in the no topics error.
This commit is contained in:
Azareal 2019-11-02 14:42:24 +10:00
parent bffb095b57
commit 65eadbd4b6
2 changed files with 2 additions and 6 deletions

View File

@ -179,10 +179,6 @@ func TopicListCommon(w http.ResponseWriter, r *http.Request, user c.User, header
if err != nil { if err != nil {
return c.InternalError(err, w, r) return c.InternalError(err, w, r)
} }
// ! Need an inline error not a page level error
if len(topicList) == 0 {
return c.NotFound(w, r, header)
}
// TODO: Reduce the amount of boilerplate here // TODO: Reduce the amount of boilerplate here
if r.FormValue("js") == "1" { if r.FormValue("js") == "1" {

View File

@ -78,9 +78,9 @@
<div class="rowitem rowmsg"><a href="" class="more_topics"></a></div> <div class="rowitem rowmsg"><a href="" class="more_topics"></a></div>
</div> </div>
<div id="topic_list" class="rowblock topic_list topic_list_{{.Sort.SortBy}}" aria-label="{{lang "topics_list_aria"}}"> <div id="topic_list" class="rowblock topic_list topic_list_{{.Sort.SortBy}}" aria-label="{{lang "topics_list_aria"}}">
{{range .TopicList}}{{template "topics_topic.html" . }}{{else}}<div class="rowitem passive rowmsg">{{lang "topics_no_topics"}}{{if .CurrentUser.Loggedin}}{{if .CurrentUser.Perms.CreateTopic}} <a href="/topics/create/">{{lang "topics_start_one"}}</a>{{end}}{{end}}</div>{{end}} {{range .TopicList}}{{template "topics_topic.html" . }}{{else}}<div class="rowitem passive rowmsg">{{lang "topics_no_topics"}}{{if .CurrentUser.Loggedin}}{{if .CurrentUser.Perms.CreateTopic}}&nbsp;<a href="/topics/create/">{{lang "topics_start_one"}}</a>{{end}}{{end}}</div>{{end}}
</div> </div>
{{template "paginator.html" . }} {{template "paginator.html" . }}
</main> </main>
{{template "footer.html" . }} {{template "footer.html" . }}