avoid full page load for /topics/

save bytes
This commit is contained in:
Azareal 2020-04-11 18:12:37 +10:00
parent 3d87ad8895
commit d1506d8567
11 changed files with 152 additions and 136 deletions

View File

@ -791,26 +791,26 @@ function mainInit(){
// The time range selector for the time graphs in the Control Panel // The time range selector for the time graphs in the Control Panel
$(".autoSubmitRedirect").change(function(){ $(".autoSubmitRedirect").change(function(){
let elems = this.form.elements; let els = this.form.elements;
let s = ""; let s = "";
for(let i=0; i<elems.length; i++) { for(let i=0; i<els.length; i++) {
let elem = elems[i]; let el = els[i];
if(elem.nodeName=="SELECT") { if(el.nodeName=="SELECT") {
s += elem.name+"="+elem.options[elem.selectedIndex].getAttribute("value")+"&"; s += el.name+"="+el.options[el.selectedIndex].getAttribute("value")+"&";
} }
// TODO: Implement other element types... // TODO: Implement other element types...
} }
if(s.length > 0) s = "?"+s.substr(0, s.length-1); if(s.length > 0) s = "?"+s.substr(0, s.length-1);
window.location = this.form.getAttribute("action") + s; // Do a redirect as a form submission refuses to work properly window.location = this.form.getAttribute("action")+s; // Do a redirect as a form submission refuses to work properly
}); });
$(".unix_to_24_hour_time").each(function(){ $(".unix_to_24_hour_time").each(function(){
let unixTime = this.innerText; let unixTime = this.innerText;
let date = new Date(unixTime*1000); let date = new Date(unixTime*1000);
console.log("date",date); console.log("date",date);
let minutes = "0"+date.getMinutes(); let mins = "0"+date.getMinutes();
let formattedTime = date.getHours()+":"+minutes.substr(-2); let formattedTime = date.getHours()+":"+mins.substr(-2);
console.log("formattedTime",formattedTime); console.log("formattedTime",formattedTime);
this.innerText = formattedTime; this.innerText = formattedTime;
}); });
@ -884,8 +884,7 @@ function mainInit(){
else pro = asyncGetScript("/s/"+res) else pro = asyncGetScript("/s/"+res)
pro.then(() => console.log("Loaded "+res)) pro.then(() => console.log("Loaded "+res))
.catch(e => { .catch(e => {
console.log("Unable to get '"+res+"'"); console.log("Unable to get '"+res+"'",e);
console.log("e",e);
console.trace(); console.trace();
}); });
} }
@ -899,8 +898,7 @@ function mainInit(){
let obj = {Title:document.title,Url:base}; let obj = {Title:document.title,Url:base};
history.pushState(obj,obj.Title,obj.Url); history.pushState(obj,obj.Title,obj.Url);
}).catch(e => { }).catch(e => {
console.log("Unable to get script '"+href+""+"'"); console.log("Unable to get script '"+href+""+"'",e);
console.log("e",e);
console.trace(); console.trace();
}); });
} }
@ -911,6 +909,13 @@ function mainInit(){
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();
}) })
$("a").click(function(ev) {
let base = this.getAttribute("href");
if(base!="/topics/") return;
loadArb(base,base+"?i=1");
ev.stopPropagation();
ev.preventDefault();
})
runInitHook("almost_end_init"); runInitHook("almost_end_init");
runInitHook("end_init"); runInitHook("end_init");

View File

@ -19,16 +19,16 @@ func wsTopicList(topicList []*c.TopicsRow, lastPage int) *c.WsTopicList {
return &c.WsTopicList{wsTopicList, lastPage, 0} return &c.WsTopicList{wsTopicList, lastPage, 0}
} }
func TopicList(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError { func TopicList(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError {
skip, rerr := h.Hooks.VhookSkippable("route_topic_list_start", w, r, user, h) skip, rerr := h.Hooks.VhookSkippable("route_topic_list_start", w, r, u, h)
if skip || rerr != nil { if skip || rerr != nil {
return rerr return rerr
} }
return TopicListCommon(w, r, user, h, "lastupdated", 0) return TopicListCommon(w, r, u, h, "lastupdated", 0)
} }
func TopicListMostViewed(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header) c.RouteError { func TopicListMostViewed(w http.ResponseWriter, r *http.Request, u *c.User, h *c.Header) c.RouteError {
return TopicListCommon(w, r, user, h, "mostviewed", c.TopicListMostViewed) return TopicListCommon(w, r, u, h, "mostviewed", c.TopicListMostViewed)
} }
// TODO: Implement search // TODO: Implement search
@ -191,5 +191,8 @@ func TopicListCommon(w http.ResponseWriter, r *http.Request, user *c.User, h *c.
} }
pi := c.TopicListPage{h, topicList, forumList, c.Config.DefaultForum, c.TopicListSort{torder, false}, pagi} pi := c.TopicListPage{h, topicList, forumList, c.Config.DefaultForum, c.TopicListSort{torder, false}, pagi}
if r.FormValue("i") == "1" {
return renderTemplate("topics_mini", w, r, h, pi)
}
return renderTemplate("topics", w, r, h, pi) return renderTemplate("topics", w, r, h, pi)
} }

View File

@ -11,13 +11,13 @@
</div> </div>
<div class="colstack_item convo_row_box">{{template "convo_row.html" .}}</div> <div class="colstack_item convo_row_box">{{template "convo_row.html" .}}</div>
{{if .CanReply}} {{if .CanReply}}
<form action="/user/convo/create/submit/{{.Convo.ID}}?s={{.CurrentUser.Session}}" method="post"> <form action="/user/convo/create/submit/{{.Convo.ID}}?s={{.CurrentUser.Session}}"method="post">
<div class="colstack_item topic_reply_form" style="border-top:none;"> <div class="colstack_item topic_reply_form"style="border-top:none;">
<div class="formrow"> <div class="formrow">
<div class="formitem"><textarea class="input_content" name="content" placeholder="{{lang "profile.comments_form_content"}}"></textarea></div> <div class="formitem"><textarea class="input_content"name="content"placeholder="{{lang "profile.comments_form_content"}}"></textarea></div>
</div> </div>
<div class="formrow quick_button_row"> <div class="formrow quick_button_row">
<div class="formitem"><button name="reply-button" class="formbutton">{{lang "profile.comments_form_button"}}</button></div> <div class="formitem"><button name="reply-button"class="formbutton">{{lang "profile.comments_form_button"}}</button></div>
</div> </div>
</div> </div>
</form> </form>

View File

@ -1,22 +1,22 @@
<div class="colstack_item colstack_head rowhead"> <div class="colstack_item colstack_head rowhead">
<div class="rowitem"> <div class="rowitem">
<h1>{{lang "convos_head"}}</h1> <h1>{{lang "convos_head"}}</h1>
{{if .CurrentUser.Perms.UseConvos or .CurrentUser.Perms.UseConvosIfWithMod}}<h2><a class="create_convo_link" href="/user/convos/create/">{{lang "convos_create"}}</a></h2>{{end}} {{if .CurrentUser.Perms.UseConvos or .CurrentUser.Perms.UseConvosIfWithMod}}<h2><a class="create_convo_link"href="/user/convos/create/">{{lang "convos_create"}}</a></h2>{{end}}
</div> </div>
</div> </div>
{{if .CurrentUser.Perms.UseConvos or .CurrentUser.Perms.UseConvosIfWithMod}} {{if .CurrentUser.Perms.UseConvos or .CurrentUser.Perms.UseConvosIfWithMod}}
<div class="colstack_item the_form convo_create_form auto_hide"> <div class="colstack_item the_form convo_create_form auto_hide">
<form action="/user/convos/create/submit/?s={{.CurrentUser.Session}}" method="post"> <form action="/user/convos/create/submit/?s={{.CurrentUser.Session}}"method="post">
<div class="formrow real_first_child"> <div class="formrow real_first_child">
<div class="formitem formlabel"><a>{{lang "create_convo_recp"}}</a></div> <div class="formitem formlabel"><a>{{lang "create_convo_recp"}}</a></div>
<div class="formitem"><input name="recp" type="text"></div> <div class="formitem"><input name="recp"type="text"></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem"><textarea name="body"></textarea></div> <div class="formitem"><textarea name="body"></textarea></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem"> <div class="formitem">
<button name="panel-button" class="formbutton">{{lang "create_convo_button"}}</button> <button name="panel-button"class="formbutton">{{lang "create_convo_button"}}</button>
<button class="formbutton close_form">{{lang "quick_topic.cancel_button"}}</button> <button class="formbutton close_form">{{lang "quick_topic.cancel_button"}}</button>
</div> </div>
</div> </div>
@ -27,10 +27,10 @@
{{range .Convos}} {{range .Convos}}
<div class="rowitem"> <div class="rowitem">
<span class="to_left"> <span class="to_left">
{{if .OneOnOne}}{{range .ShortUsers}}<img class="bgsub" src="{{.MicroAvatar}}" height=48 width=48>{{end}}{{end}} {{if .OneOnOne}}{{range .ShortUsers}}<img class="bgsub"src="{{.MicroAvatar}}"height=48 width=48>{{end}}{{end}}
<a href="/user/convo/{{.ID}}">{{range .ShortUsers}}<span class="convos_item_user">{{.Name}}</span>&nbsp;{{end}}</a></span></a> <a href="/user/convo/{{.ID}}">{{range .ShortUsers}}<span class="convos_item_user">{{.Name}}</span>&nbsp;{{end}}</a></span></a>
</span> </span>
<span title="{{abstime .LastReplyAt}}" class="to_right">{{reltime .LastReplyAt}}</span> <span title="{{abstime .LastReplyAt}}"class="to_right">{{reltime .LastReplyAt}}</span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div>{{else}} </div>{{else}}
<div class="rowitem">{{lang "convos_none"}}</div> <div class="rowitem">{{lang "convos_none"}}</div>

View File

@ -6,7 +6,7 @@
{{if ne .LastPage .Page}}<div id="nextFloat"class="next_button"><a class="next_link"aria-label="{{lang "paginator.next_page_aria"}}" rel="next"href="{{.Forum.Link}}?page={{add .Page 1}}">{{lang "paginator.greater_than"}}</a></div>{{end}} {{if ne .LastPage .Page}}<div id="nextFloat"class="next_button"><a class="next_link"aria-label="{{lang "paginator.next_page_aria"}}" rel="next"href="{{.Forum.Link}}?page={{add .Page 1}}">{{lang "paginator.greater_than"}}</a></div>{{end}}
{{if not .CurrentUser.Loggedin}}<link rel="canonical"href="//{{.Site.URL}}{{.Forum.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}">{{end}} {{if not .CurrentUser.Loggedin}}<link rel="canonical"href="//{{.Site.URL}}{{.Forum.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}">{{end}}
<div id="forum_head_block" class="rowblock rowhead topic_list_title_block{{if .CurrentUser.Loggedin}} has_opt{{end}}"> <div id="forum_head_block"class="rowblock rowhead topic_list_title_block{{if .CurrentUser.Loggedin}} has_opt{{end}}">
<div class="rowitem forum_title"> <div class="rowitem forum_title">
<h1 itemprop="name">{{.Title}}</h1> <h1 itemprop="name">{{.Title}}</h1>
</div> </div>
@ -15,12 +15,12 @@
{{if .CurrentUser.Perms.CreateTopic}} {{if .CurrentUser.Perms.CreateTopic}}
<div class="opt dummy_opt"></div> <div class="opt dummy_opt"></div>
<div class="pre_opt auto_hide"></div> <div class="pre_opt auto_hide"></div>
<div class="opt create_topic_opt"title="{{lang "topic_list.create_topic_tooltip"}}" aria-label="{{lang "topic_list.create_topic_aria"}}"><a class="create_topic_link" href="/topics/create/{{.Forum.ID}}"></a></div> <div class="opt create_topic_opt"title="{{lang "topic_list.create_topic_tooltip"}}"aria-label="{{lang "topic_list.create_topic_aria"}}"><a class="create_topic_link"href="/topics/create/{{.Forum.ID}}"></a></div>
{{/** TODO: Add a permissions check for this **/}} {{/** TODO: Add a permissions check for this **/}}
<div class="opt mod_opt"title="{{lang "topic_list.moderate_tooltip"}}"> <div class="opt mod_opt"title="{{lang "topic_list.moderate_tooltip"}}">
<a class="moderate_link" href="#" aria-label="{{lang "topic_list.moderate_aria"}}"></a> <a class="moderate_link"href="#"aria-label="{{lang "topic_list.moderate_aria"}}"></a>
</div> </div>
{{else}}<div class="opt locked_opt"title="{{lang "forum_locked_tooltip"}}" aria-label="{{lang "forum_locked_aria"}}"><a></a></div>{{end}} {{else}}<div class="opt locked_opt"title="{{lang "forum_locked_tooltip"}}"aria-label="{{lang "forum_locked_aria"}}"><a></a></div>{{end}}
</div> </div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
{{end}} {{end}}
@ -30,14 +30,14 @@
{{if .CurrentUser.Perms.CreateTopic}} {{if .CurrentUser.Perms.CreateTopic}}
<div id="forum_topic_create_form"class="rowblock topic_create_form quick_create_form auto_hide"aria-label="{{lang "quick_topic.aria"}}"> <div id="forum_topic_create_form"class="rowblock topic_create_form quick_create_form auto_hide"aria-label="{{lang "quick_topic.aria"}}">
<form id="quick_post_form" enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form> <form id="quick_post_form"enctype="multipart/form-data" action="/topic/create/submit/?s={{.CurrentUser.Session}}"method="post"></form>
<img class="little_row_avatar" src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}"> <img class="little_row_avatar"src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}"title="{{lang "quick_topic.avatar_tooltip"}}">
<input form="quick_post_form" id="topic_board_input" name="board" value="{{.Forum.ID}}" type="hidden"> <input form="quick_post_form"id="topic_board_input"name="board"value="{{.Forum.ID}}"type="hidden">
<div class="main_form"> <div class="main_form">
<div class="topic_meta"> <div class="topic_meta">
<div class="formrow topic_name_row real_first_child"> <div class="formrow topic_name_row real_first_child">
<div class="formitem"> <div class="formitem">
<input form="quick_post_form" name="name" placeholder="{{lang "quick_topic.whatsup"}}" required> <input form="quick_post_form"name="name"placeholder="{{lang "quick_topic.whatsup"}}"required>
</div> </div>
</div> </div>
</div> </div>
@ -46,11 +46,11 @@
</div> </div>
{{end}} {{end}}
{{end}} {{end}}
<div id="forum_topic_list" class="rowblock topic_list single_forum" aria-label="{{lang "forum_list_aria"}}"> <div id="forum_topic_list"class="rowblock topic_list single_forum" aria-label="{{lang "forum_list_aria"}}">
{{range .ItemList}}<div class="topic_row{{if .Sticky}} topic_sticky{{else if .IsClosed}} topic_closed{{end}}" data-tid="{{.ID}}"> {{range .ItemList}}<div class="topic_row{{if .Sticky}} topic_sticky{{else if .IsClosed}} topic_closed{{end}}"data-tid="{{.ID}}">
<div class="rowitem topic_left passive datarow"> <div class="rowitem topic_left passive datarow">
<span class="selector"></span> <span class="selector"></span>
<a href="{{.Creator.Link}}"><img src="{{.Creator.MicroAvatar}}" height=64 alt="Avatar"title="{{.Creator.Name}}'s Avatar"aria-hidden="true"></a> <a href="{{.Creator.Link}}"><img src="{{.Creator.MicroAvatar}}"height=64 alt="Avatar"title="{{.Creator.Name}}'s Avatar"aria-hidden="true"></a>
<span class="topic_inner_left"> <span class="topic_inner_left">
<a class="rowtopic"href="{{.Link}}"itemprop="itemListElement"title="{{.Title}}"><span>{{.Title}}</span></a> <a class="rowtopic"href="{{.Link}}"itemprop="itemListElement"title="{{.Title}}"><span>{{.Title}}</span></a>
<br><a class="rowsmall starter"href="{{.Creator.Link}}"title="{{.Creator.Name}}">{{.Creator.Name}}</a> <br><a class="rowsmall starter"href="{{.Creator.Link}}"title="{{.Creator.Name}}">{{.Creator.Name}}</a>

View File

@ -4,13 +4,13 @@
<div class="rowitem"><h1>{{lang "password_reset_head"}}</h1></div> <div class="rowitem"><h1>{{lang "password_reset_head"}}</h1></div>
</div> </div>
<div class="rowblock the_form"> <div class="rowblock the_form">
<form action="/accounts/password-reset/submit/" method="post"> <form action="/accounts/password-reset/submit/"method="post">
<div class="formrow login_name_row"> <div class="formrow login_name_row">
<div class="formitem formlabel"><a id="login_name_label">{{lang "password_reset_username"}}</a></div> <div class="formitem formlabel"><a id="login_name_label">{{lang "password_reset_username"}}</a></div>
<div class="formitem"><input name="username" type="text" aria-labelledby="login_name_label" required></div> <div class="formitem"><input name="username"type="text"aria-labelledby="login_name_label"required></div>
</div> </div>
<div class="formrow login_button_row form_button_row"> <div class="formrow login_button_row form_button_row">
<div class="formitem"><button name="login-button" class="formbutton">{{lang "password_reset_button"}}</button></div> <div class="formitem"><button name="login-button"class="formbutton">{{lang "password_reset_button"}}</button></div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -4,25 +4,25 @@
<div class="rowitem"><h1>{{lang "password_reset_token_head"}}</h1></div> <div class="rowitem"><h1>{{lang "password_reset_token_head"}}</h1></div>
</div> </div>
<div class="rowblock the_form"> <div class="rowblock the_form">
<form action="/accounts/password-reset/token/submit/" method="post"> <form action="/accounts/password-reset/token/submit/"method="post">
<input name="uid" value="{{.UID}}" type="hidden"> <input name="uid"value="{{.UID}}"type="hidden">
<input name="token" value="{{.Token}}" type="hidden"> <input name="token"value="{{.Token}}"type="hidden">
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a id="password_label">{{lang "password_reset_token_password"}}</a></div> <div class="formitem formlabel"><a id="password_label">{{lang "password_reset_token_password"}}</a></div>
<div class="formitem"><input name="password" type="password" autocomplete="new-password" placeholder="*****" aria-labelledby="password_label" required></div> <div class="formitem"><input name="password"type="password"autocomplete="new-password"placeholder="*****"aria-labelledby="password_label"required></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a id="confirm_password_label">{{lang "password_reset_token_confirm_password"}}</a></div> <div class="formitem formlabel"><a id="confirm_password_label">{{lang "password_reset_token_confirm_password"}}</a></div>
<div class="formitem"><input name="confirm_password" type="password" placeholder="*****" autocomplete="new-password" aria-labelledby="confirm_password_label" required></div> <div class="formitem"><input name="confirm_password"type="password"placeholder="*****"autocomplete="new-password"aria-labelledby="confirm_password_label"required></div>
</div> </div>
{{if .MFA}} {{if .MFA}}
<div class="formrow mfa_token_row"> <div class="formrow mfa_token_row">
<div class="formitem formlabel"><a id="mfa_token_label">{{lang "password_reset_mfa_token"}}</a></div> <div class="formitem formlabel"><a id="mfa_token_label">{{lang "password_reset_mfa_token"}}</a></div>
<div class="formitem"><input name="mfa_token" type="text" autocomplete="off" placeholder="*****" aria-labelledby="mfa_token_label" required></div> <div class="formitem"><input name="mfa_token"type="text"autocomplete="off"placeholder="*****"aria-labelledby="mfa_token_label"required></div>
</div> </div>
{{end}} {{end}}
<div class="formrow login_button_row form_button_row"> <div class="formrow login_button_row form_button_row">
<div class="formitem"><button name="token-button" class="formbutton">{{lang "password_reset_token_button"}}</button></div> <div class="formitem"><button name="token-button"class="formbutton">{{lang "password_reset_token_button"}}</button></div>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,19 +1,19 @@
{{range .ItemList}} {{range .ItemList}}
<div id="post-{{.ID}}" class="rowitem passive deletable_block editable_parent comment {{.ClassName}}"> <div id="post-{{.ID}}"class="rowitem passive deletable_block editable_parent comment {{.ClassName}}">
<div class="topRow"> <div class="topRow">
<div class="userbit"> <div class="userbit">
<img src="{{.MicroAvatar}}"alt="Avatar"title="{{.CreatedByName}}'s Avatar"aria-hidden="true"> <img src="{{.MicroAvatar}}"alt="Avatar"title="{{.CreatedByName}}'s Avatar"aria-hidden="true">
<span class="nameAndTitle"> <span class="nameAndTitle">
<a href="{{.UserLink}}"class="real_username username">{{.CreatedByName}}</a> <a href="{{.UserLink}}"class="real_username username">{{.CreatedByName}}</a>
{{if .Tag}}<a class="username hide_on_mobile user_tag" style="float:right;">{{.Tag}}</a>{{end}} {{if .Tag}}<a class="username hide_on_mobile user_tag"style="float:right;">{{.Tag}}</a>{{end}}
</span> </span>
</div> </div>
<span class="controls"> <span class="controls">
{{if $.CurrentUser.IsMod}} {{if $.CurrentUser.IsMod}}
<a href="/profile/reply/edit/submit/{{.ID}}?s={{$.CurrentUser.Session}}"class="mod_button"title="{{lang "profile.comments_edit_tooltip"}}" aria-label="{{lang "profile.comments_edit_aria"}}"><button class="username edit_item edit_label"></button></a> <a href="/profile/reply/edit/submit/{{.ID}}?s={{$.CurrentUser.Session}}"class="mod_button"title="{{lang "profile.comments_edit_tooltip"}}"aria-label="{{lang "profile.comments_edit_aria"}}"><button class="username edit_item edit_label"></button></a>
<a href="/profile/reply/delete/submit/{{.ID}}?s={{$.CurrentUser.Session}}"class="mod_button"title="{{lang "profile.comments_delete_tooltip"}}" aria-label="{{lang "profile.comments_delete_aria"}}"><button class="username delete_item delete_label"></button></a> <a href="/profile/reply/delete/submit/{{.ID}}?s={{$.CurrentUser.Session}}"class="mod_button"title="{{lang "profile.comments_delete_tooltip"}}"aria-label="{{lang "profile.comments_delete_aria"}}"><button class="username delete_item delete_label"></button></a>
{{end}} {{end}}
<a class="mod_button"href="/report/submit/{{.ID}}?s={{$.CurrentUser.Session}}&type=user-reply"><button class="username report_item flag_label"title="{{lang "profile.comments_report_tooltip"}}" aria-label="{{lang "profile.comments_report_aria"}}"></button></a> <a class="mod_button"href="/report/submit/{{.ID}}?s={{$.CurrentUser.Session}}&type=user-reply"><button class="username report_item flag_label"title="{{lang "profile.comments_report_tooltip"}}"aria-label="{{lang "profile.comments_report_aria"}}"></button></a>
</span> </span>
</div> </div>
<div class="content_column"> <div class="content_column">

View File

@ -1,85 +1,3 @@
{{template "header.html" . }} {{template "header.html" . }}
<main id="topicsItemList" itemscope itemtype="http://schema.org/ItemList"> {{template "topics_inner.html" . }}
{{if not .CurrentUser.Loggedin}}<link rel="canonical"href="//{{.Site.URL}}/topics/{{if eq .Sort.SortBy "mostviewed"}}most-viewed/{{end}}{{if gt .Page 1}}?page={{.Page}}{{end}}">{{end}}
<div class="rowblock rowhead topic_list_title_block{{if .CurrentUser.Loggedin}} has_opt{{end}}">
<div class="rowitem topic_list_title"><h1 itemprop="name">{{.Title}}</h1></div>
{{if .CurrentUser.Loggedin}}
<div class="optbox">
{{if .ForumList}}
<div class="opt filter_opt">
<a class="filter_opt_sep"> - </a>
<a href="#" class="filter_opt_label link_label" data-for="topic_list_filter_select">{{if eq .Sort.SortBy "mostviewed"}}{{lang "topic_list.most_viewed_filter"}}{{else}}{{lang "topic_list.most_recent_filter"}}{{end}} <span class="filter_opt_pointy"></span></a>
<div id="topic_list_filter_select" class="link_select">
<div class="link_option link_selected">
<a href="/topics/">{{lang "topic_list.most_recent_filter"}}</a>
</div>
<div class="link_option">
<a href="/topics/most-viewed/">{{lang "topic_list.most_viewed_filter"}}</a>
</div>
</div>
</div>
<div class="pre_opt auto_hide"></div>
<div class="opt create_topic_opt" title="{{lang "topic_list.create_topic_tooltip"}}" aria-label="{{lang "topic_list.create_topic_aria"}}"><a class="create_topic_link" href="/topics/create/"></a></div>
{{/** TODO: Add a permissions check for this **/}}
<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><div style="clear:both;"></div>
{{end}}
</div>
{{if .CurrentUser.Loggedin}}
{{template "topics_mod_floater.html"}}
{{if .ForumList}}
{{/** TODO: Have a seperate forum list for moving topics? Maybe an AJAX forum search compatible with plugin_guilds? **/}}
{{/** TODO: Add ARIA attributes for this **/}}
<div id="mod_topic_mover" class="modal_pane auto_hide">
<form action="/topic/move/submit/?s={{.CurrentUser.Session}}" method="post">
<input id="mover_fid"name="fid"value=0 type="hidden">
<div class="pane_header">
<h3>{{lang "topic_list.move_head"}}</h3>
</div>
<div class="pane_body">
<div class="pane_table">
{{range .ForumList}}<div id="mover_fid_{{.ID}}"data-fid="{{.ID}}"class="pane_row">{{.Name}}</div>{{end}}
</div>
</div>
<div class="pane_buttons">
<button id="mover_submit">{{lang "topic_list.move_button"}}</button>
</div>
</form>
</div>
<div class="rowblock topic_create_form quick_create_form auto_hide" aria-label="{{lang "quick_topic.aria"}}">
<form name="topic_create_form_form"id="quick_post_form" enctype="multipart/form-data"action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
<img class="little_row_avatar"src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}">
<div class="main_form">
<div class="topic_meta">
<div class="formrow topic_board_row real_first_child">
<div class="formitem"><select form="quick_post_form" id="topic_board_input" name="board">
{{range .ForumList}}<option value="{{.ID}}"{{if eq .ID $.DefaultForum}}selected{{end}}>{{.Name}}</option>{{end}}
</select></div>
</div>
<div class="formrow topic_name_row">
<div class="formitem">
<input form="quick_post_form" name="name" placeholder="{{lang "quick_topic.whatsup"}}" required>
</div>
</div>
</div>
{{template "topics_quick_topic.html" . }}
</div>
</div>
{{end}}
{{end}}
<div class="rowblock more_topic_block more_topic_block_initial">
<div class="rowitem rowmsg"><a href=""class="more_topics"></a></div>
</div>
<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}}&nbsp;<a href="/topics/create/">{{lang "topics_start_one"}}</a>{{end}}{{end}}</div>{{end}}
</div>
{{template "paginator.html" . }}
</main>
{{template "footer.html" . }} {{template "footer.html" . }}

View File

@ -0,0 +1,83 @@
<main id="topicsItemList"itemscope itemtype="http://schema.org/ItemList">
{{if not .CurrentUser.Loggedin}}<link rel="canonical"href="//{{.Site.URL}}/topics/{{if eq .Sort.SortBy "mostviewed"}}most-viewed/{{end}}{{if gt .Page 1}}?page={{.Page}}{{end}}">{{end}}
<div class="rowblock rowhead topic_list_title_block{{if .CurrentUser.Loggedin}} has_opt{{end}}">
<div class="rowitem topic_list_title"><h1 itemprop="name">{{.Title}}</h1></div>
{{if .CurrentUser.Loggedin}}
<div class="optbox">
{{if .ForumList}}
<div class="opt filter_opt">
<a class="filter_opt_sep"> - </a>
<a href="#"class="filter_opt_label link_label"data-for="topic_list_filter_select">{{if eq .Sort.SortBy "mostviewed"}}{{lang "topic_list.most_viewed_filter"}}{{else}}{{lang "topic_list.most_recent_filter"}}{{end}} <span class="filter_opt_pointy"></span></a>
<div id="topic_list_filter_select"class="link_select">
<div class="link_option link_selected">
<a href="/topics/">{{lang "topic_list.most_recent_filter"}}</a>
</div>
<div class="link_option">
<a href="/topics/most-viewed/">{{lang "topic_list.most_viewed_filter"}}</a>
</div>
</div>
</div>
<div class="pre_opt auto_hide"></div>
<div class="opt create_topic_opt"title="{{lang "topic_list.create_topic_tooltip"}}"aria-label="{{lang "topic_list.create_topic_aria"}}"><a class="create_topic_link"href="/topics/create/"></a></div>
{{/** TODO: Add a permissions check for this **/}}
<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><div style="clear:both;"></div>
{{end}}
</div>
{{if .CurrentUser.Loggedin}}
{{template "topics_mod_floater.html"}}
{{if .ForumList}}
{{/** TODO: Have a seperate forum list for moving topics? Maybe an AJAX forum search compatible with plugin_guilds? **/}}
{{/** TODO: Add ARIA attributes for this **/}}
<div id="mod_topic_mover" class="modal_pane auto_hide">
<form action="/topic/move/submit/?s={{.CurrentUser.Session}}" method="post">
<input id="mover_fid"name="fid"value=0 type="hidden">
<div class="pane_header">
<h3>{{lang "topic_list.move_head"}}</h3>
</div>
<div class="pane_body">
<div class="pane_table">
{{range .ForumList}}<div id="mover_fid_{{.ID}}"data-fid="{{.ID}}"class="pane_row">{{.Name}}</div>{{end}}
</div>
</div>
<div class="pane_buttons">
<button id="mover_submit">{{lang "topic_list.move_button"}}</button>
</div>
</form>
</div>
<div class="rowblock topic_create_form quick_create_form auto_hide" aria-label="{{lang "quick_topic.aria"}}">
<form name="topic_create_form_form"id="quick_post_form" enctype="multipart/form-data"action="/topic/create/submit/?s={{.CurrentUser.Session}}" method="post"></form>
<img class="little_row_avatar"src="{{.CurrentUser.MicroAvatar}}" height=64 alt="{{lang "quick_topic.avatar_alt"}}" title="{{lang "quick_topic.avatar_tooltip"}}">
<div class="main_form">
<div class="topic_meta">
<div class="formrow topic_board_row real_first_child">
<div class="formitem"><select form="quick_post_form"id="topic_board_input"name="board">
{{range .ForumList}}<option value="{{.ID}}"{{if eq .ID $.DefaultForum}}selected{{end}}>{{.Name}}</option>{{end}}
</select></div>
</div>
<div class="formrow topic_name_row">
<div class="formitem">
<input form="quick_post_form"name="name"placeholder="{{lang "quick_topic.whatsup"}}"required>
</div>
</div>
</div>
{{template "topics_quick_topic.html" . }}
</div>
</div>
{{end}}
{{end}}
<div class="rowblock more_topic_block more_topic_block_initial">
<div class="rowitem rowmsg"><a href=""class="more_topics"></a></div>
</div>
<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}}&nbsp;<a href="/topics/create/">{{lang "topics_start_one"}}</a>{{end}}{{end}}</div>{{end}}
</div>
{{template "paginator.html" . }}
</main>

View File

@ -0,0 +1,7 @@
<div id="back"class="zone_{{.Header.Zone}}{{if hasWidgets "rightSidebar" .Header }} shrink_main{{end}}">
<div id="main">
<div class="alertbox initial_alertbox">{{range .Header.NoticeList}}{{template "notice.html" . }}{{end}}</div>
{{template "topics_inner.html" . }}
</div>
<aside class="midRight sidebar">{{dock "rightSidebar" .Header}}</aside>
</div>