Let's see how we can best do this o-o
This commit is contained in:
parent
eb6db07c30
commit
a1403d495d
|
@ -100,11 +100,17 @@ type TopicPage struct {
|
|||
LastPage int
|
||||
}
|
||||
|
||||
type TopicListSort struct {
|
||||
SortBy string // lastupdate, mostviewed, mostviewedtoday, mostviewedthisweek, mostviewedthismonth
|
||||
Ascending bool
|
||||
}
|
||||
|
||||
type TopicListPage struct {
|
||||
*Header
|
||||
TopicList []*TopicsRow
|
||||
ForumList []Forum
|
||||
DefaultForum int
|
||||
Sort TopicListSort
|
||||
Paginator
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ func CompileTemplates() error {
|
|||
var topicsList []*TopicsRow
|
||||
topicsList = append(topicsList, &TopicsRow{1, "topic-title", "Topic Title", "The topic content.", 1, false, false, now, now, "Date", user3.ID, 1, "", "127.0.0.1", 1, 0, 1, "classname", "", &user2, "", 0, &user3, "General", "/forum/general.2"})
|
||||
header2.Title = "Topic List"
|
||||
topicListPage := TopicListPage{header, topicsList, forumList, Config.DefaultForum, Paginator{[]int{1}, 1, 1}}
|
||||
topicListPage := TopicListPage{header, topicsList, forumList, Config.DefaultForum, TopicListSort{"lastupdated", false}, Paginator{[]int{1}, 1, 1}}
|
||||
topicListTmpl, err := c.Compile("topics.html", "templates/", "common.TopicListPage", topicListPage, varList)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -44,7 +44,7 @@ func TopicList(w http.ResponseWriter, r *http.Request, user common.User) common.
|
|||
return common.NotFound(w, r, header)
|
||||
}
|
||||
|
||||
pi := common.TopicListPage{header, topicList, forumList, common.Config.DefaultForum, paginator}
|
||||
pi := common.TopicListPage{header, topicList, forumList, common.Config.DefaultForum, common.TopicListSort{"lastupdated", false}, paginator}
|
||||
if common.RunPreRenderHook("pre_render_topic_list", w, r, &user, &pi) {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<div class="opt mod_opt" title="{{lang "topic_list.moderate_tooltip"}}">
|
||||
<a class="moderate_link" href="#" aria-label="{{lang "topic_list.moderate_aria"}}"></a>
|
||||
</div>
|
||||
{{else}}<div class="opt locked_opt" title="{{lang "topics_locked_tooltip"}}" aria-label="{{lang "topics_locked_aria"}}"><a></a></div>{{end}}
|
||||
<div class="opt"><select><option selected>Last Updated</option><option>Most Viewed</option></select></div>
|
||||
{{else}}<div class="opt locked_opt" title="{{lang "topics_locked_tooltip"}}" aria-label="{{lang "topics_locked_aria"}}"><a></a></div>{{end}}
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
{{end}}
|
||||
|
|
Loading…
Reference in New Issue