try to optimise routeAPI

This commit is contained in:
Azareal 2020-03-09 15:16:44 +10:00
parent b04d77d7b6
commit 28f210371e
18 changed files with 75 additions and 63 deletions

View File

@ -192,7 +192,7 @@ func buildAlertSb(sb *strings.Builder, msg string, sub []string, path, avatar st
sb.WriteRune('}') sb.WriteRune('}')
} }
func BuildAlertSb(sb *strings.Builder, a Alert, user User /* The current user */) (err error) { func BuildAlertSb(sb *strings.Builder, a *Alert, user User /* The current user */) (err error) {
var targetUser *User var targetUser *User
if a.Actor == nil { if a.Actor == nil {
a.Actor, err = Users.Get(a.ActorID) a.Actor, err = Users.Get(a.ActorID)

View File

@ -46,7 +46,7 @@ function bindToAlerts() {
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();
$.ajax({ $.ajax({
url: "/api/?action=set&module=dismiss-alert", url: "/api/?a=set&m=dismiss-alert",
type: "POST", type: "POST",
dataType: "json", dataType: "json",
data: { id: $(this).attr("data-asid") }, data: { id: $(this).attr("data-asid") },
@ -137,7 +137,7 @@ function loadAlerts(menuAlerts, eTc = false) {
$.ajax({ $.ajax({
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
url:'/api/?module=alerts' + tc, url:'/api/?m=alerts' + tc,
success: (data) => { success: (data) => {
if("errmsg" in data) { if("errmsg" in data) {
setAlertError(menuAlerts,data.errmsg) setAlertError(menuAlerts,data.errmsg)
@ -150,7 +150,7 @@ function loadAlerts(menuAlerts, eTc = false) {
if(eTc && lastTc != 0) { if(eTc && lastTc != 0) {
for(var i in data.msgs) wsAlertEvent(data.msgs[i]); for(var i in data.msgs) wsAlertEvent(data.msgs[i]);
} else {*/ } else {*/
console.log("data:",data.count); console.log("data",data);
for(var i in data.msgs) addAlert(data.msgs[i]); for(var i in data.msgs) addAlert(data.msgs[i]);
alertCount = data.count; alertCount = data.count;
updateAlertList(menuAlerts); updateAlertList(menuAlerts);
@ -311,7 +311,7 @@ function runWebSockets(resume = false) {
moreTopicBlock.classList.remove("more_topic_block_initial"); moreTopicBlock.classList.remove("more_topic_block_initial");
moreTopicBlock.classList.add("more_topic_block_active"); moreTopicBlock.classList.add("more_topic_block_active");
console.log("phraseBox:",phraseBox); console.log("phraseBox",phraseBox);
let msgBox = moreTopicBlock.getElementsByClassName("more_topics")[0]; let msgBox = moreTopicBlock.getElementsByClassName("more_topics")[0];
msgBox.innerText = phraseBox["topic_list"]["topic_list.changed_topics"].replace("%d",moreTopicCount); msgBox.innerText = phraseBox["topic_list"]["topic_list.changed_topics"].replace("%d",moreTopicCount);
} }
@ -347,7 +347,7 @@ function runWebSockets(resume = false) {
console.log("before notify on alert") console.log("before notify on alert")
// We can only get away with this because template_alert has no phrases, otherwise it too would have to be part of the "dance", I miss Go concurrency :( // We can only get away with this because template_alert has no phrases, otherwise it too would have to be part of the "dance", I miss Go concurrency :(
if(!noAlerts) { if(!noAlerts) {
notifyOnScriptW("template_alert", (e) => { notifyOnScriptW("template_alert", e => {
if(e!=undefined) console.log("failed alert? why?", e) if(e!=undefined) console.log("failed alert? why?", e)
}, () => { }, () => {
if(!Template_alert) throw("template function not found"); if(!Template_alert) throw("template function not found");
@ -424,8 +424,8 @@ function mainInit(){
moreTopicCount = 0; moreTopicCount = 0;
}) })
$(".add_like,.remove_like").click(function(event) { $(".add_like,.remove_like").click(function(ev) {
event.preventDefault(); ev.preventDefault();
//$(this).unbind("click"); //$(this).unbind("click");
let target = this.closest("a").getAttribute("href"); let target = this.closest("a").getAttribute("href");
console.log("target", target); console.log("target", target);
@ -459,7 +459,7 @@ function mainInit(){
success: function (data, status, xhr) { success: function (data, status, xhr) {
if("success" in data && data["success"] == "1") return; if("success" in data && data["success"] == "1") return;
// addNotice("Failed to add a like: {err}") // addNotice("Failed to add a like: {err}")
//likeCountNode.innerHTML = parseInt(likeCountNode.innerHTML) - 1; //likeCountNode.innerHTML = parseInt(likeCountNode.innerHTML)-1;
console.log("data", data); console.log("data", data);
console.log("status", status); console.log("status", status);
console.log("xhr", xhr); console.log("xhr", xhr);
@ -467,11 +467,11 @@ function mainInit(){
}); });
}); });
$(".link_label").click(function(event) { $(".link_label").click(function(ev) {
event.preventDefault(); ev.preventDefault();
let linkSelect = $('#'+$(this).attr("data-for")); let linkSelect = $('#'+$(this).attr("data-for"));
if(!linkSelect.hasClass("link_opened")) { if(!linkSelect.hasClass("link_opened")) {
event.stopPropagation(); ev.stopPropagation();
linkSelect.addClass("link_opened"); linkSelect.addClass("link_opened");
} }
}); });
@ -902,10 +902,10 @@ function mainInit(){
$(".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 minutes = "0" + date.getMinutes();
let formattedTime = date.getHours() + ":" + minutes.substr(-2); let formattedTime = date.getHours() + ":" + minutes.substr(-2);
console.log("formattedTime:", formattedTime); console.log("formattedTime", formattedTime);
this.innerText = formattedTime; this.innerText = formattedTime;
}); });
@ -913,10 +913,10 @@ function mainInit(){
// TODO: Localise this // TODO: Localise this
let monthList = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; let monthList = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
let date = new Date(this.innerText * 1000); let date = new Date(this.innerText * 1000);
console.log("date: ", date); console.log("date", date);
let day = "0" + date.getDate(); let day = "0" + date.getDate();
let formattedTime = monthList[date.getMonth()] + " " + day.substr(-2) + " " + date.getFullYear(); let formattedTime = monthList[date.getMonth()] + " " + day.substr(-2) + " " + date.getFullYear();
console.log("formattedTime:", formattedTime); console.log("formattedTime", formattedTime);
this.innerText = formattedTime; this.innerText = formattedTime;
}); });
@ -939,7 +939,7 @@ function mainInit(){
$("#poll_results_" + pollID).removeClass("auto_hide"); $("#poll_results_" + pollID).removeClass("auto_hide");
fetch("/poll/results/" + pollID, { fetch("/poll/results/" + pollID, {
credentials: 'same-origin' credentials: 'same-origin'
}).then((response) => response.text()).catch((error) => console.error("Error:",error)).then((rawData) => { }).then(resp => resp.text()).catch(err => console.error("err:",err)).then((rawData) => {
// TODO: Make sure the received data is actually a list of integers // TODO: Make sure the received data is actually a list of integers
let data = JSON.parse(rawData); let data = JSON.parse(rawData);
let allZero = true; let allZero = true;

View File

@ -102,7 +102,7 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
}); });
} catch(e) { } catch(e) {
// TODO: Use a notice instead // TODO: Use a notice instead
console.log("e:",e); console.log("e",e);
alert(e); alert(e);
} }
} }
@ -125,7 +125,7 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
if(isImage) fileItem.style.backgroundImage = "url("+e.target.result+")"; if(isImage) fileItem.style.backgroundImage = "url("+e.target.result+")";
fileDock.appendChild(fileItem); fileDock.appendChild(fileItem);
},(e,hash, filename) => { },(e,hash,filename) => {
console.log("hash",hash); console.log("hash",hash);
let ext = getExt(filename) let ext = getExt(filename)
let content = document.getElementById("input_content") let content = document.getElementById("input_content")
@ -142,7 +142,7 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
}); });
} catch(e) { } catch(e) {
// TODO: Use a notice instead // TODO: Use a notice instead
console.log("e:",e); console.log("e",e);
alert(e); alert(e);
} }
} }
@ -248,8 +248,8 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
} }
}); });
}; };
$(".mod_floater_submit").click(function(event){ $(".mod_floater_submit").click(function(ev){
event.preventDefault(); ev.preventDefault();
let selectNode = this.form.querySelector(".mod_floater_options"); let selectNode = this.form.querySelector(".mod_floater_options");
let optionNode = selectNode.options[selectNode.selectedIndex]; let optionNode = selectNode.options[selectNode.selectedIndex];
let action = optionNode.getAttribute("value"); let action = optionNode.getAttribute("value");
@ -265,12 +265,12 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
let fid = this.getAttribute("data-fid"); let fid = this.getAttribute("data-fid");
if (fid == null) return; if (fid == null) return;
this.classList.add("pane_selected"); this.classList.add("pane_selected");
console.log("fid:" + fid); console.log("fid", fid);
forumToMoveTo = fid; forumToMoveTo = fid;
$("#mover_submit").unbind("click"); $("#mover_submit").unbind("click");
$("#mover_submit").click(function(event){ $("#mover_submit").click(ev => {
event.preventDefault(); ev.preventDefault();
bulkActionSender("move",selectedTopics,forumToMoveTo); bulkActionSender("move",selectedTopics,forumToMoveTo);
}); });
}); });
@ -284,7 +284,7 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
function addPollInput() { function addPollInput() {
console.log("clicked on pollinputinput"); console.log("clicked on pollinputinput");
let dataPollInput = $(this).parent().attr("data-pollinput"); let dataPollInput = $(this).parent().attr("data-pollinput");
console.log("dataPollInput:", dataPollInput); console.log("dataPollInput", dataPollInput);
if(dataPollInput == undefined) return; if(dataPollInput == undefined) return;
if(dataPollInput != (pollInputIndex-1)) return; if(dataPollInput != (pollInputIndex-1)) return;
$(".poll_content_row .formitem").append(Template_topic_c_poll_input({ $(".poll_content_row .formitem").append(Template_topic_c_poll_input({
@ -292,13 +292,13 @@ var imageExts = ["png", "jpg", "jpe","jpeg","jif","jfi","jfif", "svg", "bmp", "g
Place: phraseBox["topic"]["topic.reply_add_poll_option"].replace("%d",pollInputIndex), Place: phraseBox["topic"]["topic.reply_add_poll_option"].replace("%d",pollInputIndex),
})); }));
pollInputIndex++; pollInputIndex++;
console.log("new pollInputIndex: ", pollInputIndex); console.log("new pollInputIndex", pollInputIndex);
$(".pollinputinput").off("click"); $(".pollinputinput").off("click");
$(".pollinputinput").click(addPollInput); $(".pollinputinput").click(addPollInput);
} }
var pollInputIndex = 1; var pollInputIndex = 1;
$("#add_poll_button").click((ev) => { $("#add_poll_button").click(ev => {
ev.preventDefault(); ev.preventDefault();
$(".poll_content_row").removeClass("auto_hide"); $(".poll_content_row").removeClass("auto_hide");
$("#has_poll_input").val("1"); $("#has_poll_input").val("1");

View File

@ -140,13 +140,13 @@ func UploadAction(fname, path string, args ...string) *uploadAction {
return &uploadAction{route} return &uploadAction{route}
} }
func (action *uploadAction) MaxSizeVar(varName string) *RouteImpl { func (a *uploadAction) MaxSizeVar(varName string) *RouteImpl {
action.Route.LitBeforeMultiline(`err = c.HandleUploadRoute(w,req,user,` + varName + `) a.Route.LitBeforeMultiline(`err = c.HandleUploadRoute(w,req,user,` + varName + `)
if err != nil { if err != nil {
return err return err
}`) }`)
action.Route.Before("NoUploadSessionMismatch") a.Route.Before("NoUploadSessionMismatch")
return action.Route return a.Route
} }
type RouteSet struct { type RouteSet struct {

View File

@ -41,7 +41,7 @@ func routeAPI(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
return c.PreErrorJS("Bad Form", w, r) return c.PreErrorJS("Bad Form", w, r)
} }
action := r.FormValue("action") action := r.FormValue("a")
if action == "" { if action == "" {
action = "get" action = "get"
} }
@ -49,7 +49,7 @@ func routeAPI(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
return c.PreErrorJS("Invalid Action", w, r) return c.PreErrorJS("Invalid Action", w, r)
} }
switch r.FormValue("module") { switch r.FormValue("m") {
// TODO: Split this into it's own function // TODO: Split this into it's own function
case "dismiss-alert": case "dismiss-alert":
id, err := strconv.Atoi(r.FormValue("id")) id, err := strconv.Atoi(r.FormValue("id"))
@ -104,12 +104,24 @@ func routeAPI(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
return c.InternalErrorJS(err, w, r) return c.InternalErrorJS(err, w, r)
} }
if count == 0 {
gzw, ok := w.(c.GzipResponseWriter)
if ok {
w = gzw.ResponseWriter
h := w.Header()
h.Del("Content-Type")
h.Del("Content-Encoding")
}
_, _ = io.WriteString(w, `{}`)
return nil
}
rCreatedAt, _ := strconv.ParseInt(r.FormValue("t"), 10, 64) rCreatedAt, _ := strconv.ParseInt(r.FormValue("t"), 10, 64)
rCount, _ := strconv.Atoi(r.FormValue("c")) rCount, _ := strconv.Atoi(r.FormValue("c"))
//log.Print("rCreatedAt:", rCreatedAt) //log.Print("rCreatedAt:", rCreatedAt)
//log.Print("rCount:", rCount) //log.Print("rCount:", rCount)
var actors []int var actors []int
var alerts []c.Alert var alerts []*c.Alert
var createdAt time.Time var createdAt time.Time
var topCreatedAt int64 var topCreatedAt int64
@ -121,7 +133,7 @@ func routeAPI(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
defer rows.Close() defer rows.Close()
for rows.Next() { for rows.Next() {
var al c.Alert al := &c.Alert{}
err = rows.Scan(&al.ASID, &al.ActorID, &al.TargetUserID, &al.Event, &al.ElementType, &al.ElementID, &createdAt) err = rows.Scan(&al.ASID, &al.ActorID, &al.TargetUserID, &al.Event, &al.ElementType, &al.ElementID, &createdAt)
if err != nil { if err != nil {
return c.InternalErrorJS(err, w, r) return c.InternalErrorJS(err, w, r)
@ -142,7 +154,7 @@ func routeAPI(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
} }
} }
if count == 0 || len(alerts) == 0 || (rCreatedAt != 0 && rCreatedAt >= topCreatedAt && count == rCount) { if len(alerts) == 0 || (rCreatedAt != 0 && rCreatedAt >= topCreatedAt && count == rCount) {
gzw, ok := w.(c.GzipResponseWriter) gzw, ok := w.(c.GzipResponseWriter)
if ok { if ok {
w = gzw.ResponseWriter w = gzw.ResponseWriter

View File

@ -5,13 +5,13 @@
<span id="dash_username"> <span id="dash_username">
<form id="dash_username_form" action="/user/edit/username/submit/?s={{.CurrentUser.Session}}" method="post"></form> <form id="dash_username_form" action="/user/edit/username/submit/?s={{.CurrentUser.Session}}" method="post"></form>
<form id="revoke_avatar_form" action="/user/edit/avatar/revoke/submit/?s={{.CurrentUser.Session}}" method="post"></form> <form id="revoke_avatar_form" action="/user/edit/avatar/revoke/submit/?s={{.CurrentUser.Session}}" method="post"></form>
<input form="dash_username_form" name="account-new-username" value="{{.CurrentUser.Name}}" /> <input form="dash_username_form" name="account-new-username" value="{{.CurrentUser.Name}}"/>
<button form="dash_username_form" class="formbutton">{{lang "account_username_save"}}</button> <button form="dash_username_form" class="formbutton">{{lang "account_username_save"}}</button>
</span> </span>
<img src="{{.CurrentUser.Avatar}}" height="128px" /> <img src="{{.CurrentUser.Avatar}}" height="128px" />
<span id="dash_avatar_buttons"> <span id="dash_avatar_buttons">
{{if .CurrentUser.Perms.UploadAvatars}} {{if .CurrentUser.Perms.UploadAvatars}}
<input form="avatar_form" id="select_avatar" name="account-avatar" type="file" required class="auto_hide" /> <input form="avatar_form" id="select_avatar" name="account-avatar" type="file" required class="auto_hide"/>
<label for="select_avatar" class="formbutton">{{lang "account_avatar_select"}}</label> <label for="select_avatar" class="formbutton">{{lang "account_avatar_select"}}</label>
<button form="avatar_form" name="account-button" class="formbutton">{{lang "account_avatar_update_button"}}</button> <button form="avatar_form" name="account-button" class="formbutton">{{lang "account_avatar_update_button"}}</button>
{{else if .CurrentUser.RawAvatar}}<button form="revoke_avatar_form" id="revoke_avatars" name="revoke-button" class="formbutton">{{lang "account_avatar_revoke_button"}}</button>{{end}} {{else if .CurrentUser.RawAvatar}}<button form="revoke_avatar_form" id="revoke_avatars" name="revoke-button" class="formbutton">{{lang "account_avatar_revoke_button"}}</button>{{end}}

View File

@ -7,7 +7,7 @@
</div> </div>
<div class="colstack_item the_form"> <div class="colstack_item the_form">
<form action="/user/edit/mfa/setup/submit/?s={{.CurrentUser.Session}}" method="post"> <form action="/user/edit/mfa/setup/submit/?s={{.CurrentUser.Session}}" method="post">
<input name="code" value="{{.Something}}" type="hidden" /> <input name="code" value="{{.Something}}" type="hidden"/>
<div class="formrow real_first_child"> <div class="formrow real_first_child">
<div class="formitem formlabel"><a>{{lang "account_mfa_setup_explanation"}}</a></div> <div class="formitem formlabel"><a>{{lang "account_mfa_setup_explanation"}}</a></div>
<div class="formitem formlabel">{{.Something}}</div> <div class="formitem formlabel">{{.Something}}</div>

View File

@ -3,9 +3,9 @@
</div> </div>
<div class="colstack_item the_form"> <div class="colstack_item the_form">
<form action="/user/edit/privacy/submit/?s={{.CurrentUser.Session}}" method="post"> <form action="/user/edit/privacy/submit/?s={{.CurrentUser.Session}}" method="post">
<!--<input name="o_profile_comments" value="{{if .ProfileComments}}1{{else}}0{{end}}" type="hidden" /> <!--<input name="o_profile_comments" value="{{if .ProfileComments}}1{{else}}0{{end}}" type="hidden"/>
<input name="o_receive_convos" value="{{if .ReceiveConvos}}1{{else}}0{{end}}" type="hidden" />--> <input name="o_receive_convos" value="{{if .ReceiveConvos}}1{{else}}0{{end}}" type="hidden"/>-->
<input name="o_enable_embeds" value="{{if .EnableEmbeds}}1{{else}}0{{end}}" type="hidden" /> <input name="o_enable_embeds" value="{{if .EnableEmbeds}}1{{else}}0{{end}}" type="hidden"/>
<!--<div class="formrow real_first_child"> <!--<div class="formrow real_first_child">
<div class="formitem formlabel">{{lang "account_privacy_profile_comments"}}</div> <div class="formitem formlabel">{{lang "account_privacy_profile_comments"}}</div>
<div class="formitem"><select name="profile_comments"> <div class="formitem"><select name="profile_comments">

View File

@ -7,7 +7,7 @@
<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"{{if .RecpName}} value="{{.RecpName}}"{{end}} /></div> <div class="formitem"><input name="recp" type="text"{{if .RecpName}} value="{{.RecpName}}"{{end}}/></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>

View File

@ -15,7 +15,7 @@
<select id="themeSelectorSelect" name="theme" aria-label="{{lang "footer_theme_selector_aria"}}">{{range .Header.Themes}}{{if not .HideFromThemes}} <select id="themeSelectorSelect" name="theme" aria-label="{{lang "footer_theme_selector_aria"}}">{{range .Header.Themes}}{{if not .HideFromThemes}}
<option value="{{.Name}}"{{if eq $.Header.Theme.Name .Name}} selected{{end}}>{{.FriendlyName}}</option> <option value="{{.Name}}"{{if eq $.Header.Theme.Name .Name}} selected{{end}}>{{.FriendlyName}}</option>
{{end}}{{end}}</select> {{end}}{{end}}</select>
<noscript><input type="submit" /></noscript> <noscript><input type="submit"/></noscript>
</div> </div>
</form> </form>
</div> </div>

View File

@ -30,7 +30,7 @@
{{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">

View File

@ -1,6 +1,6 @@
{{template "header.html" . }} {{template "header.html" . }}
<link rel="canonical" href="//{{.Site.URL}}{{.Forum.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}" /> <link rel="canonical" href="//{{.Site.URL}}{{.Forum.Link}}{{if gt .Page 1}}?page={{.Page}}{{end}}"/>
<main id="forumItemList" itemscope itemtype="http://schema.org/ItemList"> <main id="forumItemList" itemscope itemtype="http://schema.org/ItemList">
<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}}">
@ -28,7 +28,7 @@
{{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">
@ -46,11 +46,11 @@
<div id="forum_topic_list" class="rowblock micro_grid" aria-label="{{lang "forum_list_aria"}}" style="grid-template-columns:repeat(auto-fit,minmax(130px,1fr));"> <div id="forum_topic_list" class="rowblock micro_grid" aria-label="{{lang "forum_list_aria"}}" style="grid-template-columns:repeat(auto-fit,minmax(130px,1fr));">
{{range .ItemList}}<div class="rowitem" data-tid="{{.ID}}"> {{range .ItemList}}<div class="rowitem" data-tid="{{.ID}}">
<div> <div>
<a class="rowtopic" href="{{.Link}}" itemprop="itemListElement"><img src="{{.Content}}" style="width:100%;height:160px;" /></a> <a class="rowtopic" href="{{.Link}}" itemprop="itemListElement"><img src="{{.Content}}" style="width:100%;height:160px;"/></a>
<br /><a class="rowsmall starter" href="{{.Link}}">{{.Title}}</a> <br /><a class="rowsmall starter" href="{{.Link}}">{{.Title}}</a>
</div> </div>
<!--<div class="topic_left passive datarow"> <!--<div class="topic_left passive datarow">
<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>
@ -65,7 +65,7 @@
</div> </div>
<div class="topic_right passive datarow"> <div class="topic_right passive datarow">
<div class="topic_right_inside"> <div class="topic_right_inside">
<a href="{{.LastUser.Link}}"><img src="{{.LastUser.MicroAvatar}}" height=64 alt="Avatar" title="{{.LastUser.Name}}'s Avatar" aria-hidden="true" /></a> <a href="{{.LastUser.Link}}"><img src="{{.LastUser.MicroAvatar}}" height=64 alt="Avatar" title="{{.LastUser.Name}}'s Avatar" aria-hidden="true"/></a>
<span> <span>
<a href="{{.LastUser.Link}}" class="lastName" style="font-size: 14px;" title="{{.LastUser.Name}}">{{.LastUser.Name}}</a><br> <a href="{{.LastUser.Link}}" class="lastName" style="font-size: 14px;" title="{{.LastUser.Name}}">{{.LastUser.Name}}</a><br>
<a href="{{.Link}}?page={{.LastPage}}{{if .LastReplyID}}#post-{{.LastReplyID}}{{end}}" class="rowsmall lastReplyAt" title="{{abstime .LastReplyAt}}">{{reltime .LastReplyAt}}</a> <a href="{{.Link}}?page={{.LastPage}}{{if .LastReplyID}}#post-{{.LastReplyID}}{{end}}" class="rowsmall lastReplyAt" title="{{abstime .LastReplyAt}}">{{reltime .LastReplyAt}}</a>

View File

@ -8,13 +8,13 @@
<form action="/users/ips/" method="get" id="ip-search-form"></form> <form action="/users/ips/" method="get" id="ip-search-form"></form>
<div class="rowblock ip_search_block"> <div class="rowblock ip_search_block">
<div class="rowitem passive"> <div class="rowitem passive">
<input form="ip-search-form" name="ip" class="ip_search_input" type="search" placeholder="🔍︎"{{if .IP}} value="{{.IP}}"{{end}} /> <input form="ip-search-form" name="ip" class="ip_search_input" type="search" placeholder="🔍︎"{{if .IP}} value="{{.IP}}"{{end}}/>
<input form="ip-search-form" class="ip_search_search" type="submit" value="{{lang "ip_search_search_button"}}" /> <input form="ip-search-form" class="ip_search_search" type="submit" value="{{lang "ip_search_search_button"}}"/>
</div> </div>
</div> </div>
{{if .IP}}<div class="rowblock rowlist bgavatars micro_grid{{if .ItemList}} has_items{{end}}"> {{if .IP}}<div class="rowblock rowlist bgavatars micro_grid{{if .ItemList}} has_items{{end}}">
{{range .ItemList}}<div class="rowitem" style="background-image:url('{{.Avatar}}');"> {{range .ItemList}}<div class="rowitem" style="background-image:url('{{.Avatar}}');">
<img src="{{.Avatar}}" class="bgsub" alt="Avatar" aria-hidden="true" /> <img src="{{.Avatar}}" class="bgsub" alt="Avatar" aria-hidden="true"/>
<a class="rowTitle" href="{{.Link}}">{{.Name}}</a> <a class="rowTitle" href="{{.Link}}">{{.Name}}</a>
</div> </div>
{{else}}<div class="rowitem rowmsg">{{lang "ip_search_no_users"}}</div>{{end}} {{else}}<div class="rowitem rowmsg">{{lang "ip_search_no_users"}}</div>{{end}}

View File

@ -5,11 +5,11 @@
<form action="/panel/forums/edit/submit/{{.ID}}?s={{.CurrentUser.Session}}" method="post"> <form action="/panel/forums/edit/submit/{{.ID}}?s={{.CurrentUser.Session}}" method="post">
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel_forum_name"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel_forum_name"}}</a></div>
<div class="formitem"><input name="forum_name" type="text" value="{{.Name}}" placeholder="{{lang "panel_forum_name_placeholder"}}" /></div> <div class="formitem"><input name="forum_name" type="text" value="{{.Name}}" placeholder="{{lang "panel_forum_name_placeholder"}}"/></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel_forum_description"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel_forum_description"}}</a></div>
<div class="formitem"><input name="forum_desc" type="text" value="{{.Desc}}" placeholder="{{lang "panel_forum_description_placeholder"}}" /></div> <div class="formitem"><input name="forum_desc" type="text" value="{{.Desc}}" placeholder="{{lang "panel_forum_description_placeholder"}}"/></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel_forum_active"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel_forum_active"}}</a></div>
@ -47,7 +47,7 @@
<div class="formrow"> <div class="formrow">
<div class="formitem editable_parent"> <div class="formitem editable_parent">
<a>{{.Group.Name}}</a> <a>{{.Group.Name}}</a>
<input name="gid" value="{{.Group.ID}}" type="hidden" class="editable_block" data-field="gid" data-type="hidden" data-value="{{.Group.ID}}" /> <input name="gid" value="{{.Group.ID}}" type="hidden" class="editable_block" data-field="gid" data-type="hidden" data-value="{{.Group.ID}}"/>
<span class="edit_fields hide_on_edit rowsmall">{{lang "panel_forum_edit_button"}}</span> <span class="edit_fields hide_on_edit rowsmall">{{lang "panel_forum_edit_button"}}</span>
<div class="panel_floater"> <div class="panel_floater">
<span data-field="perm_preset" data-type="list" data-value="{{.Preset}}" class="editable_block perm_preset perm_preset_{{.Preset}}"></span> <span data-field="perm_preset" data-type="list" data-value="{{.Preset}}" class="editable_block perm_preset perm_preset_{{.Preset}}"></span>

View File

@ -37,11 +37,11 @@
<form action="/panel/forums/create/?s={{.CurrentUser.Session}}" method="post"> <form action="/panel/forums/create/?s={{.CurrentUser.Session}}" method="post">
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_create_name_label"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel.forums_create_name_label"}}</a></div>
<div class="formitem"><input name="name" type="text" placeholder="{{lang "panel.forums_create_name"}}" /></div> <div class="formitem"><input name="name" type="text" placeholder="{{lang "panel.forums_create_name"}}"/></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_create_description_label"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel.forums_create_description_label"}}</a></div>
<div class="formitem"><input name="desc" type="text" placeholder="{{lang "panel.forums_create_description"}}" /></div> <div class="formitem"><input name="desc" type="text" placeholder="{{lang "panel.forums_create_description"}}"/></div>
</div> </div>
<div class="formrow"> <div class="formrow">
<div class="formitem formlabel"><a>{{lang "panel.forums_active_label"}}</a></div> <div class="formitem formlabel"><a>{{lang "panel.forums_active_label"}}</a></div>