You can now view the results of polls.

Added the polls_options table.
We now spell suspicious correctly.
www URLs are now redirected to non-www URLs.
This commit is contained in:
Azareal 2018-01-28 14:30:24 +00:00
parent 9efed8c0bc
commit 0c26b5a8da
16 changed files with 440 additions and 287 deletions

View File

@ -59,9 +59,11 @@ type DefaultPollStore struct {
get *sql.Stmt get *sql.Stmt
exists *sql.Stmt exists *sql.Stmt
create *sql.Stmt createPoll *sql.Stmt
createPollOption *sql.Stmt
addVote *sql.Stmt addVote *sql.Stmt
incrementVoteCount *sql.Stmt incrementVoteCount *sql.Stmt
incrementVoteCountForOption *sql.Stmt
delete *sql.Stmt delete *sql.Stmt
//pollCount *sql.Stmt //pollCount *sql.Stmt
} }
@ -76,9 +78,11 @@ func NewDefaultPollStore(cache PollCache) (*DefaultPollStore, error) {
cache: cache, cache: cache,
get: acc.Select("polls").Columns("parentID, parentTable, type, options, votes").Where("pollID = ?").Prepare(), get: acc.Select("polls").Columns("parentID, parentTable, type, options, votes").Where("pollID = ?").Prepare(),
exists: acc.Select("polls").Columns("pollID").Where("pollID = ?").Prepare(), exists: acc.Select("polls").Columns("pollID").Where("pollID = ?").Prepare(),
create: acc.Insert("polls").Columns("parentID, parentTable, type, options").Fields("?,?,?,?").Prepare(), createPoll: acc.Insert("polls").Columns("parentID, parentTable, type, options").Fields("?,?,?,?").Prepare(),
createPollOption: acc.Insert("polls_options").Columns("pollID, option, votes").Fields("?,?,0").Prepare(),
addVote: acc.Insert("polls_votes").Columns("pollID, uid, option, castAt, ipaddress").Fields("?,?,?,UTC_TIMESTAMP(),?").Prepare(), addVote: acc.Insert("polls_votes").Columns("pollID, uid, option, castAt, ipaddress").Fields("?,?,?,UTC_TIMESTAMP(),?").Prepare(),
incrementVoteCount: acc.Update("polls").Set("votes = votes + 1").Where("pollID = ?").Prepare(), incrementVoteCount: acc.Update("polls").Set("votes = votes + 1").Where("pollID = ?").Prepare(),
incrementVoteCountForOption: acc.Update("polls_options").Set("votes = votes + 1").Where("option = ? AND pollID = ?").Prepare(),
//pollCount: acc.SimpleCount("polls", "", ""), //pollCount: acc.SimpleCount("polls", "", ""),
}, acc.FirstError() }, acc.FirstError()
} }
@ -147,16 +151,21 @@ func (store *DefaultPollStore) CastVote(optionIndex int, pollID int, uid int, ip
return err return err
} }
_, err = store.incrementVoteCount.Exec(pollID) _, err = store.incrementVoteCount.Exec(pollID)
if err != nil {
return err
}
_, err = store.incrementVoteCountForOption.Exec(optionIndex, pollID)
return err return err
} }
// TODO: Use a transaction for this
func (store *DefaultPollStore) Create(parent Pollable, pollType int, pollOptions map[int]string) (id int, err error) { func (store *DefaultPollStore) Create(parent Pollable, pollType int, pollOptions map[int]string) (id int, err error) {
pollOptionsTxt, err := json.Marshal(pollOptions) pollOptionsTxt, err := json.Marshal(pollOptions)
if err != nil { if err != nil {
return 0, err return 0, err
} }
res, err := store.create.Exec(parent.GetID(), parent.GetTable(), pollType, pollOptionsTxt) res, err := store.createPoll.Exec(parent.GetID(), parent.GetTable(), pollType, pollOptionsTxt)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -165,7 +174,14 @@ func (store *DefaultPollStore) Create(parent Pollable, pollType int, pollOptions
if err != nil { if err != nil {
return 0, err return 0, err
} }
return int(lastID), parent.SetPoll(int(lastID)) // TODO: Delete the poll if SetPoll fails
for i := 0; i < len(pollOptions); i++ {
_, err := store.createPollOption.Exec(lastID, i)
if err != nil {
return 0, err
}
}
return int(lastID), parent.SetPoll(int(lastID)) // TODO: Delete the poll (and options) if SetPoll fails
} }
func (store *DefaultPollStore) SetCache(cache PollCache) { func (store *DefaultPollStore) SetCache(cache PollCache) {

View File

@ -101,6 +101,7 @@ var RouteMap = map[string]interface{}{
"routes.ProfileReplyEditSubmit": routes.ProfileReplyEditSubmit, "routes.ProfileReplyEditSubmit": routes.ProfileReplyEditSubmit,
"routes.ProfileReplyDeleteSubmit": routes.ProfileReplyDeleteSubmit, "routes.ProfileReplyDeleteSubmit": routes.ProfileReplyDeleteSubmit,
"routes.PollVote": routes.PollVote, "routes.PollVote": routes.PollVote,
"routes.PollResults": routes.PollResults,
"routeLogin": routeLogin, "routeLogin": routeLogin,
"routeRegister": routeRegister, "routeRegister": routeRegister,
"routeLogout": routeLogout, "routeLogout": routeLogout,
@ -198,14 +199,15 @@ var routeMapEnum = map[string]int{
"routes.ProfileReplyEditSubmit": 82, "routes.ProfileReplyEditSubmit": 82,
"routes.ProfileReplyDeleteSubmit": 83, "routes.ProfileReplyDeleteSubmit": 83,
"routes.PollVote": 84, "routes.PollVote": 84,
"routeLogin": 85, "routes.PollResults": 85,
"routeRegister": 86, "routeLogin": 86,
"routeLogout": 87, "routeRegister": 87,
"routeLoginSubmit": 88, "routeLogout": 88,
"routeRegisterSubmit": 89, "routeLoginSubmit": 89,
"routeDynamic": 90, "routeRegisterSubmit": 90,
"routeUploads": 91, "routeDynamic": 91,
"BadRoute": 92, "routeUploads": 92,
"BadRoute": 93,
} }
var reverseRouteMapEnum = map[int]string{ var reverseRouteMapEnum = map[int]string{
0: "routeAPI", 0: "routeAPI",
@ -293,14 +295,15 @@ var reverseRouteMapEnum = map[int]string{
82: "routes.ProfileReplyEditSubmit", 82: "routes.ProfileReplyEditSubmit",
83: "routes.ProfileReplyDeleteSubmit", 83: "routes.ProfileReplyDeleteSubmit",
84: "routes.PollVote", 84: "routes.PollVote",
85: "routeLogin", 85: "routes.PollResults",
86: "routeRegister", 86: "routeLogin",
87: "routeLogout", 87: "routeRegister",
88: "routeLoginSubmit", 88: "routeLogout",
89: "routeRegisterSubmit", 89: "routeLoginSubmit",
90: "routeDynamic", 90: "routeRegisterSubmit",
91: "routeUploads", 91: "routeDynamic",
92: "BadRoute", 92: "routeUploads",
93: "BadRoute",
} }
var agentMapEnum = map[string]int{ var agentMapEnum = map[string]int{
"unknown": 0, "unknown": 0,
@ -415,7 +418,7 @@ func (router *GenRouter) DumpRequest(req *http.Request) {
} }
func (router *GenRouter) SuspiciousRequest(req *http.Request) { func (router *GenRouter) SuspiciousRequest(req *http.Request) {
log.Print("Supicious Request") log.Print("Suspicious Request")
router.DumpRequest(req) router.DumpRequest(req)
common.AgentViewCounter.Bump(18) common.AgentViewCounter.Bump(18)
} }
@ -424,6 +427,22 @@ func (router *GenRouter) SuspiciousRequest(req *http.Request) {
// TODO: SetDefaultRoute // TODO: SetDefaultRoute
// TODO: GetDefaultRoute // TODO: GetDefaultRoute
func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// Redirect www. requests to the right place
if req.Host == "www." + common.Site.Host {
w.Header().Set("Connection", "close")
var s string
if common.Site.EnableSsl {
s = "s"
}
dest := "http"+s+"://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
dest += "?" + req.URL.RawQuery
}
http.Redirect(w, req, dest, http.StatusMovedPermanently)
return
}
// Deflect malformed requests
if len(req.URL.Path) == 0 || req.URL.Path[0] != '/' || req.Host != common.Site.Host { if len(req.URL.Path) == 0 || req.URL.Path[0] != '/' || req.Host != common.Site.Host {
w.WriteHeader(200) // 400 w.WriteHeader(200) // 400
w.Write([]byte("")) w.Write([]byte(""))
@ -1403,6 +1422,9 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
common.RouteViewCounter.Bump(84) common.RouteViewCounter.Bump(84)
err = routes.PollVote(w,req,user,extraData) err = routes.PollVote(w,req,user,extraData)
case "/poll/results/":
common.RouteViewCounter.Bump(85)
err = routes.PollResults(w,req,user,extraData)
} }
if err != nil { if err != nil {
router.handleError(err,w,req,user) router.handleError(err,w,req,user)
@ -1410,10 +1432,10 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
case "/accounts": case "/accounts":
switch(req.URL.Path) { switch(req.URL.Path) {
case "/accounts/login/": case "/accounts/login/":
common.RouteViewCounter.Bump(85) common.RouteViewCounter.Bump(86)
err = routeLogin(w,req,user) err = routeLogin(w,req,user)
case "/accounts/create/": case "/accounts/create/":
common.RouteViewCounter.Bump(86) common.RouteViewCounter.Bump(87)
err = routeRegister(w,req,user) err = routeRegister(w,req,user)
case "/accounts/logout/": case "/accounts/logout/":
err = common.NoSessionMismatch(w,req,user) err = common.NoSessionMismatch(w,req,user)
@ -1428,7 +1450,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return return
} }
common.RouteViewCounter.Bump(87) common.RouteViewCounter.Bump(88)
err = routeLogout(w,req,user) err = routeLogout(w,req,user)
case "/accounts/login/submit/": case "/accounts/login/submit/":
err = common.ParseForm(w,req,user) err = common.ParseForm(w,req,user)
@ -1437,7 +1459,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return return
} }
common.RouteViewCounter.Bump(88) common.RouteViewCounter.Bump(89)
err = routeLoginSubmit(w,req,user) err = routeLoginSubmit(w,req,user)
case "/accounts/create/submit/": case "/accounts/create/submit/":
err = common.ParseForm(w,req,user) err = common.ParseForm(w,req,user)
@ -1446,7 +1468,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return return
} }
common.RouteViewCounter.Bump(89) common.RouteViewCounter.Bump(90)
err = routeRegisterSubmit(w,req,user) err = routeRegisterSubmit(w,req,user)
} }
if err != nil { if err != nil {
@ -1463,7 +1485,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
common.NotFound(w,req) common.NotFound(w,req)
return return
} }
common.RouteViewCounter.Bump(91) common.RouteViewCounter.Bump(92)
req.URL.Path += extraData req.URL.Path += extraData
// TODO: Find a way to propagate errors up from this? // TODO: Find a way to propagate errors up from this?
router.UploadHandler(w,req) // TODO: Count these views router.UploadHandler(w,req) // TODO: Count these views
@ -1506,7 +1528,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
router.RUnlock() router.RUnlock()
if ok { if ok {
common.RouteViewCounter.Bump(90) // TODO: Be more specific about *which* dynamic route it is common.RouteViewCounter.Bump(91) // TODO: Be more specific about *which* dynamic route it is
req.URL.Path += extraData req.URL.Path += extraData
err = handle(w,req,user) err = handle(w,req,user)
if err != nil { if err != nil {
@ -1519,7 +1541,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if strings.Contains(lowerPath,"admin") || strings.Contains(lowerPath,"sql") || strings.Contains(lowerPath,"manage") { if strings.Contains(lowerPath,"admin") || strings.Contains(lowerPath,"sql") || strings.Contains(lowerPath,"manage") {
router.SuspiciousRequest(req) router.SuspiciousRequest(req)
} }
common.RouteViewCounter.Bump(92) common.RouteViewCounter.Bump(93)
common.NotFound(w,req) common.NotFound(w,req)
} }
} }

View File

@ -245,8 +245,7 @@ $(document).ready(function(){
}); });
}); });
$(".delete_item").click(function(event) $(".delete_item").click(function(event) {
{
postLink(event); postLink(event);
$(this).closest('.deletable_block').remove(); $(this).closest('.deletable_block').remove();
}); });
@ -271,12 +270,6 @@ $(document).ready(function(){
}); });
}); });
$("#forum_quick_perms").click(function(){
$(".submit_edit").click(function(event){
});
});
$(".edit_field").click(function(event) $(".edit_field").click(function(event)
{ {
event.preventDefault(); event.preventDefault();
@ -316,8 +309,7 @@ $(document).ready(function(){
blockParent.find('.editable_block').each(function(){ blockParent.find('.editable_block').each(function(){
var fieldName = this.getAttribute("data-field"); var fieldName = this.getAttribute("data-field");
var fieldType = this.getAttribute("data-type"); var fieldType = this.getAttribute("data-type");
if(fieldType=="list") if(fieldType=="list") {
{
var fieldValue = this.getAttribute("data-value"); var fieldValue = this.getAttribute("data-value");
if(fieldName in form_vars) var it = form_vars[fieldName]; if(fieldName in form_vars) var it = form_vars[fieldName];
else var it = ['No','Yes']; else var it = ['No','Yes'];
@ -612,4 +604,22 @@ $(document).ready(function(){
$("#has_poll_input").val("1"); $("#has_poll_input").val("1");
$(".pollinputinput").click(addPollInput); $(".pollinputinput").click(addPollInput);
}); });
$(".poll_results_button").click(function(){
let pollID = $(this).attr("data-poll-id");
$("#poll_results_" + pollID + " .user_content").html("<div id='poll_results_chart_"+pollID+"'></div>");
fetch("/poll/results/" + pollID, {
credentials: 'same-origin'
}).then((response) => response.text()).catch((error) => console.error("Error:",error)).then((rawData) => {
// TODO: Make sure the received data is actually a list of integers
let data = JSON.parse(rawData);
console.log("rawData: ", rawData);
console.log("series: ", data);
Chartist.Pie('#poll_results_chart_' + pollID, {
series: data,
}, {
height: '100%',
});
})
});
}); });

View File

@ -232,6 +232,15 @@ func createTables(adapter qgen.Adapter) error {
}, },
) )
qgen.Install.CreateTable("polls_options", "", "",
[]qgen.DBTableColumn{
qgen.DBTableColumn{"pollID", "int", 0, false, false, ""},
qgen.DBTableColumn{"option", "int", 0, false, false, "0"},
qgen.DBTableColumn{"votes", "int", 0, false, false, "0"},
},
[]qgen.DBTableKey{},
)
qgen.Install.CreateTable("polls_votes", "utf8mb4", "utf8mb4_general_ci", qgen.Install.CreateTable("polls_votes", "utf8mb4", "utf8mb4_general_ci",
[]qgen.DBTableColumn{ []qgen.DBTableColumn{
qgen.DBTableColumn{"pollID", "int", 0, false, false, ""}, qgen.DBTableColumn{"pollID", "int", 0, false, false, ""},

View File

@ -291,7 +291,7 @@ func (router *GenRouter) DumpRequest(req *http.Request) {
} }
func (router *GenRouter) SuspiciousRequest(req *http.Request) { func (router *GenRouter) SuspiciousRequest(req *http.Request) {
log.Print("Supicious Request") log.Print("Suspicious Request")
router.DumpRequest(req) router.DumpRequest(req)
common.AgentViewCounter.Bump({{.AllAgentMap.suspicious}}) common.AgentViewCounter.Bump({{.AllAgentMap.suspicious}})
} }
@ -300,6 +300,22 @@ func (router *GenRouter) SuspiciousRequest(req *http.Request) {
// TODO: SetDefaultRoute // TODO: SetDefaultRoute
// TODO: GetDefaultRoute // TODO: GetDefaultRoute
func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// Redirect www. requests to the right place
if req.Host == "www." + common.Site.Host {
w.Header().Set("Connection", "close")
var s string
if common.Site.EnableSsl {
s = "s"
}
dest := "http"+s+"://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {
dest += "?" + req.URL.RawQuery
}
http.Redirect(w, req, dest, http.StatusMovedPermanently)
return
}
// Deflect malformed requests
if len(req.URL.Path) == 0 || req.URL.Path[0] != '/' || req.Host != common.Site.Host { if len(req.URL.Path) == 0 || req.URL.Path[0] != '/' || req.Host != common.Site.Host {
w.WriteHeader(200) // 400 w.WriteHeader(200) // 400
w.Write([]byte("")) w.Write([]byte(""))

View File

@ -109,6 +109,7 @@ func buildPollRoutes() {
pollGroup := newRouteGroup("/poll/") pollGroup := newRouteGroup("/poll/")
pollGroup.Routes( pollGroup.Routes(
Action("routes.PollVote", "/poll/vote/", "extraData"), Action("routes.PollVote", "/poll/vote/", "extraData"),
View("routes.PollResults", "/poll/results/", "extraData"),
) )
addRouteGroup(pollGroup) addRouteGroup(pollGroup)
} }

View File

@ -457,6 +457,9 @@ func routeTopicID(w http.ResponseWriter, r *http.Request, user common.User, urlB
return common.NoPermissions(w, r, user) return common.NoPermissions(w, r, user)
} }
headerVars.Zone = "view_topic" headerVars.Zone = "view_topic"
// TODO: Only include these on pages with polls
headerVars.Stylesheets = append(headerVars.Stylesheets, "chartist/chartist.min.css")
headerVars.Scripts = append(headerVars.Scripts, "chartist/chartist.min.js")
topic.ContentHTML = common.ParseMessage(topic.Content, topic.ParentID, "forums") topic.ContentHTML = common.ParseMessage(topic.Content, topic.ParentID, "forums")
topic.ContentLines = strings.Count(topic.Content, "\n") topic.ContentLines = strings.Count(topic.Content, "\n")

View File

@ -3,10 +3,12 @@ package routes
import ( import (
"database/sql" "database/sql"
"errors" "errors"
"log"
"net/http" "net/http"
"strconv" "strconv"
"../common" "../common"
"../query_gen/lib"
) )
func PollVote(w http.ResponseWriter, r *http.Request, user common.User, sPollID string) common.RouteError { func PollVote(w http.ResponseWriter, r *http.Request, user common.User, sPollID string) common.RouteError {
@ -65,3 +67,47 @@ func PollVote(w http.ResponseWriter, r *http.Request, user common.User, sPollID
http.Redirect(w, r, "/topic/"+strconv.Itoa(topic.ID), http.StatusSeeOther) http.Redirect(w, r, "/topic/"+strconv.Itoa(topic.ID), http.StatusSeeOther)
return nil return nil
} }
func PollResults(w http.ResponseWriter, r *http.Request, user common.User, sPollID string) common.RouteError {
log.Print("in PollResults")
pollID, err := strconv.Atoi(sPollID)
if err != nil {
return common.PreError("The provided PollID is not a valid number.", w, r)
}
poll, err := common.Polls.Get(pollID)
if err == sql.ErrNoRows {
return common.PreError("The poll you tried to vote for doesn't exist.", w, r)
} else if err != nil {
return common.InternalError(err, w, r)
}
// TODO: Abstract this
acc := qgen.Builder.Accumulator()
rows, err := acc.Select("polls_options").Columns("votes").Where("pollID = ?").Orderby("option ASC").Query(poll.ID)
if err != nil {
return common.InternalError(err, w, r)
}
defer rows.Close()
var optionList = ""
for rows.Next() {
var votes int
err := rows.Scan(&votes)
if err != nil {
return common.InternalError(err, w, r)
}
optionList += strconv.Itoa(votes) + ","
}
err = rows.Err()
if err != nil {
return common.InternalError(err, w, r)
}
// TODO: Implement a version of this which doesn't rely so much on sequential order
if len(optionList) > 0 {
optionList = optionList[:len(optionList)-1]
}
w.Write([]byte("[" + optionList + "]"))
return nil
}

View File

@ -0,0 +1,5 @@
CREATE TABLE [polls_options] (
[pollID] int not null,
[option] int DEFAULT 0 not null,
[votes] int DEFAULT 0 not null
);

View File

@ -0,0 +1,5 @@
CREATE TABLE `polls_options` (
`pollID` int not null,
`option` int DEFAULT 0 not null,
`votes` int DEFAULT 0 not null
);

View File

@ -0,0 +1,5 @@
CREATE TABLE `polls_options` (
`pollID` int not null,
`option` int DEFAULT 0 not null,
`votes` int DEFAULT 0 not null
);

View File

@ -16,6 +16,7 @@ var header_5 = []byte(`" rel="stylesheet" type="text/css">
`) `)
var header_6 = []byte(` var header_6 = []byte(`
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/static/chartist/chartist.min.js"></script>
`) `)
var header_7 = []byte(` var header_7 = []byte(`
<script type="text/javascript" src="/static/`) <script type="text/javascript" src="/static/`)
@ -384,191 +385,193 @@ var topic_alt_37 = []byte(`" />
var topic_alt_38 = []byte(`"> var topic_alt_38 = []byte(`">
<div class="sel"></div> <div class="sel"></div>
</label> </label>
<span class="poll_option_text">`) <span id="poll_option_text_`)
var topic_alt_39 = []byte(`</span> var topic_alt_39 = []byte(`" class="poll_option_text">`)
var topic_alt_40 = []byte(`</span>
</div> </div>
`) `)
var topic_alt_40 = []byte(` var topic_alt_41 = []byte(`
<div class="poll_buttons"> <div class="poll_buttons">
<button form="poll_`) <button form="poll_`)
var topic_alt_41 = []byte(`_form" class="poll_vote_button">Vote</button> var topic_alt_42 = []byte(`_form" class="poll_vote_button">Vote</button>
<button class="poll_results_button">Results</button> <button class="poll_results_button" data-poll-id="`)
var topic_alt_43 = []byte(`">Results</button>
<a href="#"><button class="poll_cancel_button">Cancel</button></a> <a href="#"><button class="poll_cancel_button">Cancel</button></a>
</div> </div>
</div> </div>
</div> </div>
<div id="poll_results_`) <div id="poll_results_`)
var topic_alt_42 = []byte(`" class="content_container poll_results auto_hide"> var topic_alt_44 = []byte(`" class="content_container poll_results auto_hide">
<div class="topic_content user_content"></div> <div class="topic_content user_content"></div>
</div> </div>
</article> </article>
`) `)
var topic_alt_43 = []byte(` var topic_alt_45 = []byte(`
<article itemscope itemtype="http://schema.org/CreativeWork" class="rowitem passive deletable_block editable_parent post_item top_post" aria-label="The opening post for this topic"> <article itemscope itemtype="http://schema.org/CreativeWork" class="rowitem passive deletable_block editable_parent post_item top_post" aria-label="The opening post for this topic">
<div class="userinfo" aria-label="The information on the poster"> <div class="userinfo" aria-label="The information on the poster">
<div class="avatar_item" style="background-image: url(`) <div class="avatar_item" style="background-image: url(`)
var topic_alt_44 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div> var topic_alt_46 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="`) <a href="`)
var topic_alt_45 = []byte(`" class="the_name" rel="author">`) var topic_alt_47 = []byte(`" class="the_name" rel="author">`)
var topic_alt_46 = []byte(`</a> var topic_alt_48 = []byte(`</a>
`) `)
var topic_alt_47 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`) var topic_alt_49 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
var topic_alt_48 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_49 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_50 = []byte(`</div><div class="tag_post"></div></div>`) var topic_alt_50 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_51 = []byte(` var topic_alt_51 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_52 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_53 = []byte(`
</div> </div>
<div class="content_container"> <div class="content_container">
<div class="hide_on_edit topic_content user_content" itemprop="text">`) <div class="hide_on_edit topic_content user_content" itemprop="text">`)
var topic_alt_52 = []byte(`</div> var topic_alt_54 = []byte(`</div>
<textarea name="topic_content" class="show_on_edit topic_content_input">`) <textarea name="topic_content" class="show_on_edit topic_content_input">`)
var topic_alt_53 = []byte(`</textarea> var topic_alt_55 = []byte(`</textarea>
<div class="button_container"> <div class="button_container">
`) `)
var topic_alt_54 = []byte(`<a href="/topic/like/submit/`) var topic_alt_56 = []byte(`<a href="/topic/like/submit/`)
var topic_alt_55 = []byte(`?session=`) var topic_alt_57 = []byte(`?session=`)
var topic_alt_56 = []byte(`" class="action_button like_item add_like" aria-label="Like this post" data-action="like"></a>`) var topic_alt_58 = []byte(`" class="action_button like_item add_like" aria-label="Like this post" data-action="like"></a>`)
var topic_alt_57 = []byte(`<a href="/topic/edit/`) var topic_alt_59 = []byte(`<a href="/topic/edit/`)
var topic_alt_58 = []byte(`" class="action_button open_edit" aria-label="Edit this post" data-action="edit"></a>`) var topic_alt_60 = []byte(`" class="action_button open_edit" aria-label="Edit this post" data-action="edit"></a>`)
var topic_alt_59 = []byte(`<a href="/topic/delete/submit/`) var topic_alt_61 = []byte(`<a href="/topic/delete/submit/`)
var topic_alt_60 = []byte(`?session=`) var topic_alt_62 = []byte(`?session=`)
var topic_alt_61 = []byte(`" class="action_button delete_item" aria-label="Delete this post" data-action="delete"></a>`) var topic_alt_63 = []byte(`" class="action_button delete_item" aria-label="Delete this post" data-action="delete"></a>`)
var topic_alt_62 = []byte(`<a href='/topic/unlock/submit/`) var topic_alt_64 = []byte(`<a href='/topic/unlock/submit/`)
var topic_alt_63 = []byte(`?session=`) var topic_alt_65 = []byte(`?session=`)
var topic_alt_64 = []byte(`' class="action_button unlock_item" data-action="unlock"></a>`) var topic_alt_66 = []byte(`' class="action_button unlock_item" data-action="unlock"></a>`)
var topic_alt_65 = []byte(`<a href='/topic/lock/submit/`) var topic_alt_67 = []byte(`<a href='/topic/lock/submit/`)
var topic_alt_66 = []byte(`?session=`) var topic_alt_68 = []byte(`?session=`)
var topic_alt_67 = []byte(`' class="action_button lock_item" data-action="lock"></a>`) var topic_alt_69 = []byte(`' class="action_button lock_item" data-action="lock"></a>`)
var topic_alt_68 = []byte(`<a href='/topic/unstick/submit/`) var topic_alt_70 = []byte(`<a href='/topic/unstick/submit/`)
var topic_alt_69 = []byte(`?session=`) var topic_alt_71 = []byte(`?session=`)
var topic_alt_70 = []byte(`' class="action_button unpin_item" data-action="unpin"></a>`) var topic_alt_72 = []byte(`' class="action_button unpin_item" data-action="unpin"></a>`)
var topic_alt_71 = []byte(`<a href='/topic/stick/submit/`) var topic_alt_73 = []byte(`<a href='/topic/stick/submit/`)
var topic_alt_72 = []byte(`?session=`) var topic_alt_74 = []byte(`?session=`)
var topic_alt_73 = []byte(`' class="action_button pin_item" data-action="pin"></a>`) var topic_alt_75 = []byte(`' class="action_button pin_item" data-action="pin"></a>`)
var topic_alt_74 = []byte(`<a href="/users/ips/?ip=`) var topic_alt_76 = []byte(`<a href="/users/ips/?ip=`)
var topic_alt_75 = []byte(`" title="IP Address" class="action_button ip_item_button hide_on_big" aria-label="This user's IP" data-action="ip"></a>`) var topic_alt_77 = []byte(`" title="IP Address" class="action_button ip_item_button hide_on_big" aria-label="This user's IP" data-action="ip"></a>`)
var topic_alt_76 = []byte(` var topic_alt_78 = []byte(`
<a href="/report/submit/`) <a href="/report/submit/`)
var topic_alt_77 = []byte(`?session=`) var topic_alt_79 = []byte(`?session=`)
var topic_alt_78 = []byte(`&type=topic" class="action_button report_item" aria-label="Report this post" data-action="report"></a> var topic_alt_80 = []byte(`&type=topic" class="action_button report_item" aria-label="Report this post" data-action="report"></a>
<a href="#" class="action_button button_menu"></a> <a href="#" class="action_button button_menu"></a>
`) `)
var topic_alt_79 = []byte(` var topic_alt_81 = []byte(`
<div class="action_button_right`) <div class="action_button_right`)
var topic_alt_80 = []byte(` has_likes`) var topic_alt_82 = []byte(` has_likes`)
var topic_alt_81 = []byte(`"> var topic_alt_83 = []byte(`">
`) `)
var topic_alt_82 = []byte(`<a class="action_button like_count hide_on_micro">`) var topic_alt_84 = []byte(`<a class="action_button like_count hide_on_micro">`)
var topic_alt_83 = []byte(`</a>`) var topic_alt_85 = []byte(`</a>`)
var topic_alt_84 = []byte(` var topic_alt_86 = []byte(`
<a class="action_button created_at hide_on_mobile">`) <a class="action_button created_at hide_on_mobile">`)
var topic_alt_85 = []byte(`</a> var topic_alt_87 = []byte(`</a>
`) `)
var topic_alt_86 = []byte(`<a href="/users/ips/?ip=`) var topic_alt_88 = []byte(`<a href="/users/ips/?ip=`)
var topic_alt_87 = []byte(`" title="IP Address" class="action_button ip_item hide_on_mobile">`) var topic_alt_89 = []byte(`" title="IP Address" class="action_button ip_item hide_on_mobile">`)
var topic_alt_88 = []byte(`</a>`) var topic_alt_90 = []byte(`</a>`)
var topic_alt_89 = []byte(` var topic_alt_91 = []byte(`
</div> </div>
</div> </div>
</div><div style="clear:both;"></div> </div><div style="clear:both;"></div>
</article> </article>
`) `)
var topic_alt_90 = []byte(` var topic_alt_92 = []byte(`
<article itemscope itemtype="http://schema.org/CreativeWork" class="rowitem passive deletable_block editable_parent post_item `) <article itemscope itemtype="http://schema.org/CreativeWork" class="rowitem passive deletable_block editable_parent post_item `)
var topic_alt_91 = []byte(`action_item`) var topic_alt_93 = []byte(`action_item`)
var topic_alt_92 = []byte(`"> var topic_alt_94 = []byte(`">
<div class="userinfo" aria-label="The information on the poster"> <div class="userinfo" aria-label="The information on the poster">
<div class="avatar_item" style="background-image: url(`) <div class="avatar_item" style="background-image: url(`)
var topic_alt_93 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div> var topic_alt_95 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="`) <a href="`)
var topic_alt_94 = []byte(`" class="the_name" rel="author">`) var topic_alt_96 = []byte(`" class="the_name" rel="author">`)
var topic_alt_95 = []byte(`</a> var topic_alt_97 = []byte(`</a>
`) `)
var topic_alt_96 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`) var topic_alt_98 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
var topic_alt_97 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_98 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_99 = []byte(`</div><div class="tag_post"></div></div>`) var topic_alt_99 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_100 = []byte(` var topic_alt_100 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_101 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_102 = []byte(`
</div> </div>
<div class="content_container" `) <div class="content_container" `)
var topic_alt_101 = []byte(`style="margin-left: 0px;"`) var topic_alt_103 = []byte(`style="margin-left: 0px;"`)
var topic_alt_102 = []byte(`> var topic_alt_104 = []byte(`>
`) `)
var topic_alt_103 = []byte(` var topic_alt_105 = []byte(`
<span class="action_icon" style="font-size: 18px;padding-right: 5px;">`) <span class="action_icon" style="font-size: 18px;padding-right: 5px;">`)
var topic_alt_104 = []byte(`</span> var topic_alt_106 = []byte(`</span>
<span itemprop="text">`) <span itemprop="text">`)
var topic_alt_105 = []byte(`</span> var topic_alt_107 = []byte(`</span>
`) `)
var topic_alt_106 = []byte(` var topic_alt_108 = []byte(`
<div class="editable_block user_content" itemprop="text">`) <div class="editable_block user_content" itemprop="text">`)
var topic_alt_107 = []byte(`</div> var topic_alt_109 = []byte(`</div>
<div class="button_container"> <div class="button_container">
`) `)
var topic_alt_108 = []byte(`<a href="/reply/like/submit/`) var topic_alt_110 = []byte(`<a href="/reply/like/submit/`)
var topic_alt_109 = []byte(`?session=`) var topic_alt_111 = []byte(`?session=`)
var topic_alt_110 = []byte(`" class="action_button like_item add_like" aria-label="Like this post" data-action="like"></a>`) var topic_alt_112 = []byte(`" class="action_button like_item add_like" aria-label="Like this post" data-action="like"></a>`)
var topic_alt_111 = []byte(`<a href="/reply/edit/submit/`) var topic_alt_113 = []byte(`<a href="/reply/edit/submit/`)
var topic_alt_112 = []byte(`?session=`) var topic_alt_114 = []byte(`?session=`)
var topic_alt_113 = []byte(`" class="action_button edit_item" aria-label="Edit this post" data-action="edit"></a>`) var topic_alt_115 = []byte(`" class="action_button edit_item" aria-label="Edit this post" data-action="edit"></a>`)
var topic_alt_114 = []byte(`<a href="/reply/delete/submit/`) var topic_alt_116 = []byte(`<a href="/reply/delete/submit/`)
var topic_alt_115 = []byte(`?session=`) var topic_alt_117 = []byte(`?session=`)
var topic_alt_116 = []byte(`" class="action_button delete_item" aria-label="Delete this post" data-action="delete"></a>`) var topic_alt_118 = []byte(`" class="action_button delete_item" aria-label="Delete this post" data-action="delete"></a>`)
var topic_alt_117 = []byte(`<a href="/users/ips/?ip=`) var topic_alt_119 = []byte(`<a href="/users/ips/?ip=`)
var topic_alt_118 = []byte(`" title="IP Address" class="action_button ip_item_button hide_on_big" aria-label="This user's IP Address" data-action="ip"></a>`) var topic_alt_120 = []byte(`" title="IP Address" class="action_button ip_item_button hide_on_big" aria-label="This user's IP Address" data-action="ip"></a>`)
var topic_alt_119 = []byte(` var topic_alt_121 = []byte(`
<a href="/report/submit/`) <a href="/report/submit/`)
var topic_alt_120 = []byte(`?session=`) var topic_alt_122 = []byte(`?session=`)
var topic_alt_121 = []byte(`&type=reply" class="action_button report_item" aria-label="Report this post" data-action="report"></a> var topic_alt_123 = []byte(`&type=reply" class="action_button report_item" aria-label="Report this post" data-action="report"></a>
<a href="#" class="action_button button_menu"></a> <a href="#" class="action_button button_menu"></a>
`) `)
var topic_alt_122 = []byte(` var topic_alt_124 = []byte(`
<div class="action_button_right`) <div class="action_button_right`)
var topic_alt_123 = []byte(` has_likes`) var topic_alt_125 = []byte(` has_likes`)
var topic_alt_124 = []byte(`"> var topic_alt_126 = []byte(`">
`) `)
var topic_alt_125 = []byte(`<a class="action_button like_count hide_on_micro">`) var topic_alt_127 = []byte(`<a class="action_button like_count hide_on_micro">`)
var topic_alt_126 = []byte(`</a>`) var topic_alt_128 = []byte(`</a>`)
var topic_alt_127 = []byte(` var topic_alt_129 = []byte(`
<a class="action_button created_at hide_on_mobile">`) <a class="action_button created_at hide_on_mobile">`)
var topic_alt_128 = []byte(`</a> var topic_alt_130 = []byte(`</a>
`) `)
var topic_alt_129 = []byte(`<a href="/users/ips/?ip=`) var topic_alt_131 = []byte(`<a href="/users/ips/?ip=`)
var topic_alt_130 = []byte(`" title="IP Address" class="action_button ip_item hide_on_mobile">`) var topic_alt_132 = []byte(`" title="IP Address" class="action_button ip_item hide_on_mobile">`)
var topic_alt_131 = []byte(`</a>`) var topic_alt_133 = []byte(`</a>`)
var topic_alt_132 = []byte(` var topic_alt_134 = []byte(`
</div> </div>
</div> </div>
`) `)
var topic_alt_133 = []byte(` var topic_alt_135 = []byte(`
</div> </div>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</article> </article>
`) `)
var topic_alt_134 = []byte(`</div> var topic_alt_136 = []byte(`</div>
`) `)
var topic_alt_135 = []byte(` var topic_alt_137 = []byte(`
<div class="rowblock topic_reply_container"> <div class="rowblock topic_reply_container">
<div class="userinfo" aria-label="The information on the poster"> <div class="userinfo" aria-label="The information on the poster">
<div class="avatar_item" style="background-image: url(`) <div class="avatar_item" style="background-image: url(`)
var topic_alt_136 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div> var topic_alt_138 = []byte(`), url(/static/white-dot.jpg);background-position: 0px -10px;">&nbsp;</div>
<a href="`) <a href="`)
var topic_alt_137 = []byte(`" class="the_name" rel="author">`) var topic_alt_139 = []byte(`" class="the_name" rel="author">`)
var topic_alt_138 = []byte(`</a> var topic_alt_140 = []byte(`</a>
`) `)
var topic_alt_139 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`) var topic_alt_141 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag">`)
var topic_alt_140 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_141 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_142 = []byte(`</div><div class="tag_post"></div></div>`) var topic_alt_142 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_143 = []byte(` var topic_alt_143 = []byte(`<div class="tag_block"><div class="tag_pre"></div><div class="post_tag post_level">Level `)
var topic_alt_144 = []byte(`</div><div class="tag_post"></div></div>`)
var topic_alt_145 = []byte(`
</div> </div>
<div class="rowblock topic_reply_form quick_create_form"> <div class="rowblock topic_reply_form quick_create_form">
<form id="reply_form" enctype="multipart/form-data" action="/reply/create/?session=`) <form id="reply_form" enctype="multipart/form-data" action="/reply/create/?session=`)
var topic_alt_144 = []byte(`" method="post"></form> var topic_alt_146 = []byte(`" method="post"></form>
<input form="reply_form" name="tid" value='`) <input form="reply_form" name="tid" value='`)
var topic_alt_145 = []byte(`' type="hidden" /> var topic_alt_147 = []byte(`' type="hidden" />
<div class="formrow real_first_child"> <div class="formrow real_first_child">
<div class="formitem"> <div class="formitem">
<textarea id="input_content" form="reply_form" name="reply-content" placeholder="What do you think?" required></textarea> <textarea id="input_content" form="reply_form" name="reply-content" placeholder="What do you think?" required></textarea>
@ -578,17 +581,17 @@ var topic_alt_145 = []byte(`' type="hidden" />
<div class="formitem"> <div class="formitem">
<button form="reply_form" name="reply-button" class="formbutton">Create Reply</button> <button form="reply_form" name="reply-button" class="formbutton">Create Reply</button>
`) `)
var topic_alt_146 = []byte(` var topic_alt_148 = []byte(`
<input name="upload_files" form="reply_form" id="upload_files" multiple type="file" style="display: none;" /> <input name="upload_files" form="reply_form" id="upload_files" multiple type="file" style="display: none;" />
<label for="upload_files" class="formbutton add_file_button">Add File</label> <label for="upload_files" class="formbutton add_file_button">Add File</label>
<div id="upload_file_dock"></div>`) <div id="upload_file_dock"></div>`)
var topic_alt_147 = []byte(` var topic_alt_149 = []byte(`
</div> </div>
</div> </div>
</div> </div>
</div> </div>
`) `)
var topic_alt_148 = []byte(` var topic_alt_150 = []byte(`
</main> </main>

View File

@ -163,243 +163,247 @@ w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_37) w.Write(topic_alt_37)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_38) w.Write(topic_alt_38)
w.Write([]byte(item.Value)) w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_39) w.Write(topic_alt_39)
} w.Write([]byte(item.Value))
}
w.Write(topic_alt_40) w.Write(topic_alt_40)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) }
}
w.Write(topic_alt_41) w.Write(topic_alt_41)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID))) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
w.Write(topic_alt_42) w.Write(topic_alt_42)
} w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
w.Write(topic_alt_43) w.Write(topic_alt_43)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar)) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Poll.ID)))
w.Write(topic_alt_44) w.Write(topic_alt_44)
w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink))
w.Write(topic_alt_45)
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
w.Write(topic_alt_46)
if tmpl_topic_alt_vars.Topic.Tag != "" {
w.Write(topic_alt_47)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
w.Write(topic_alt_48)
} else {
w.Write(topic_alt_49)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
w.Write(topic_alt_50)
} }
w.Write(topic_alt_45)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Avatar))
w.Write(topic_alt_46)
w.Write([]byte(tmpl_topic_alt_vars.Topic.UserLink))
w.Write(topic_alt_47)
w.Write([]byte(tmpl_topic_alt_vars.Topic.CreatedByName))
w.Write(topic_alt_48)
if tmpl_topic_alt_vars.Topic.Tag != "" {
w.Write(topic_alt_49)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Tag))
w.Write(topic_alt_50)
} else {
w.Write(topic_alt_51) w.Write(topic_alt_51)
w.Write([]byte(tmpl_topic_alt_vars.Topic.ContentHTML)) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.Level)))
w.Write(topic_alt_52) w.Write(topic_alt_52)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Content)) }
w.Write(topic_alt_53) w.Write(topic_alt_53)
w.Write([]byte(tmpl_topic_alt_vars.Topic.ContentHTML))
w.Write(topic_alt_54)
w.Write([]byte(tmpl_topic_alt_vars.Topic.Content))
w.Write(topic_alt_55)
if tmpl_topic_alt_vars.CurrentUser.Loggedin { if tmpl_topic_alt_vars.CurrentUser.Loggedin {
if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem {
w.Write(topic_alt_54)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_55)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_56) w.Write(topic_alt_56)
}
if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
w.Write(topic_alt_57)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_57)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_58) w.Write(topic_alt_58)
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic { if tmpl_topic_alt_vars.CurrentUser.Perms.EditTopic {
w.Write(topic_alt_59) w.Write(topic_alt_59)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_60) w.Write(topic_alt_60)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) }
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteTopic {
w.Write(topic_alt_61) w.Write(topic_alt_61)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_62)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_63)
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic { if tmpl_topic_alt_vars.CurrentUser.Perms.CloseTopic {
if tmpl_topic_alt_vars.Topic.IsClosed { if tmpl_topic_alt_vars.Topic.IsClosed {
w.Write(topic_alt_62)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_63)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_64) w.Write(topic_alt_64)
} else {
w.Write(topic_alt_65)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_66) w.Write(topic_alt_65)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_66)
} else {
w.Write(topic_alt_67) w.Write(topic_alt_67)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_68)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_69)
} }
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic { if tmpl_topic_alt_vars.CurrentUser.Perms.PinTopic {
if tmpl_topic_alt_vars.Topic.Sticky { if tmpl_topic_alt_vars.Topic.Sticky {
w.Write(topic_alt_68)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_69)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_70) w.Write(topic_alt_70)
} else {
w.Write(topic_alt_71)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_72) w.Write(topic_alt_71)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_72)
} else {
w.Write(topic_alt_73) w.Write(topic_alt_73)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_74)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_75)
} }
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_74)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_75)
}
w.Write(topic_alt_76) w.Write(topic_alt_76)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_77) w.Write(topic_alt_77)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_78)
} }
w.Write(topic_alt_78)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_79) w.Write(topic_alt_79)
if tmpl_topic_alt_vars.Topic.LikeCount > 0 { w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_80) w.Write(topic_alt_80)
} }
w.Write(topic_alt_81) w.Write(topic_alt_81)
if tmpl_topic_alt_vars.Topic.LikeCount > 0 { if tmpl_topic_alt_vars.Topic.LikeCount > 0 {
w.Write(topic_alt_82) w.Write(topic_alt_82)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount))) }
w.Write(topic_alt_83) w.Write(topic_alt_83)
} if tmpl_topic_alt_vars.Topic.LikeCount > 0 {
w.Write(topic_alt_84) w.Write(topic_alt_84)
w.Write([]byte(tmpl_topic_alt_vars.Topic.RelativeCreatedAt)) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.LikeCount)))
w.Write(topic_alt_85) w.Write(topic_alt_85)
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_86)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_87)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_88)
} }
w.Write(topic_alt_86)
w.Write([]byte(tmpl_topic_alt_vars.Topic.RelativeCreatedAt))
w.Write(topic_alt_87)
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_88)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_89) w.Write(topic_alt_89)
w.Write([]byte(tmpl_topic_alt_vars.Topic.IPAddress))
w.Write(topic_alt_90)
}
w.Write(topic_alt_91)
if len(tmpl_topic_alt_vars.ItemList) != 0 { if len(tmpl_topic_alt_vars.ItemList) != 0 {
for _, item := range tmpl_topic_alt_vars.ItemList { for _, item := range tmpl_topic_alt_vars.ItemList {
w.Write(topic_alt_90)
if item.ActionType != "" {
w.Write(topic_alt_91)
}
w.Write(topic_alt_92) w.Write(topic_alt_92)
w.Write([]byte(item.Avatar))
w.Write(topic_alt_93)
w.Write([]byte(item.UserLink))
w.Write(topic_alt_94)
w.Write([]byte(item.CreatedByName))
w.Write(topic_alt_95)
if item.Tag != "" {
w.Write(topic_alt_96)
w.Write([]byte(item.Tag))
w.Write(topic_alt_97)
} else {
w.Write(topic_alt_98)
w.Write([]byte(strconv.Itoa(item.Level)))
w.Write(topic_alt_99)
}
w.Write(topic_alt_100)
if item.ActionType != "" { if item.ActionType != "" {
w.Write(topic_alt_93)
}
w.Write(topic_alt_94)
w.Write([]byte(item.Avatar))
w.Write(topic_alt_95)
w.Write([]byte(item.UserLink))
w.Write(topic_alt_96)
w.Write([]byte(item.CreatedByName))
w.Write(topic_alt_97)
if item.Tag != "" {
w.Write(topic_alt_98)
w.Write([]byte(item.Tag))
w.Write(topic_alt_99)
} else {
w.Write(topic_alt_100)
w.Write([]byte(strconv.Itoa(item.Level)))
w.Write(topic_alt_101) w.Write(topic_alt_101)
} }
w.Write(topic_alt_102) w.Write(topic_alt_102)
if item.ActionType != "" { if item.ActionType != "" {
w.Write(topic_alt_103) w.Write(topic_alt_103)
w.Write([]byte(item.ActionIcon)) }
w.Write(topic_alt_104) w.Write(topic_alt_104)
w.Write([]byte(item.ActionType)) if item.ActionType != "" {
w.Write(topic_alt_105) w.Write(topic_alt_105)
} else { w.Write([]byte(item.ActionIcon))
w.Write(topic_alt_106) w.Write(topic_alt_106)
w.Write([]byte(item.ContentHtml)) w.Write([]byte(item.ActionType))
w.Write(topic_alt_107) w.Write(topic_alt_107)
} else {
w.Write(topic_alt_108)
w.Write([]byte(item.ContentHtml))
w.Write(topic_alt_109)
if tmpl_topic_alt_vars.CurrentUser.Loggedin { if tmpl_topic_alt_vars.CurrentUser.Loggedin {
if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem { if tmpl_topic_alt_vars.CurrentUser.Perms.LikeItem {
w.Write(topic_alt_108)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_109)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_110) w.Write(topic_alt_110)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_111)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_112)
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply { if tmpl_topic_alt_vars.CurrentUser.Perms.EditReply {
w.Write(topic_alt_111)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_112)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_113) w.Write(topic_alt_113)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_114)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_115)
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply { if tmpl_topic_alt_vars.CurrentUser.Perms.DeleteReply {
w.Write(topic_alt_114)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_115)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_116) w.Write(topic_alt_116)
} w.Write([]byte(strconv.Itoa(item.ID)))
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_117) w.Write(topic_alt_117)
w.Write([]byte(item.IPAddress)) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_118) w.Write(topic_alt_118)
} }
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_119) w.Write(topic_alt_119)
w.Write([]byte(strconv.Itoa(item.ID))) w.Write([]byte(item.IPAddress))
w.Write(topic_alt_120) w.Write(topic_alt_120)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_121)
} }
w.Write(topic_alt_121)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_alt_122) w.Write(topic_alt_122)
if item.LikeCount > 0 { w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_123) w.Write(topic_alt_123)
} }
w.Write(topic_alt_124) w.Write(topic_alt_124)
if item.LikeCount > 0 { if item.LikeCount > 0 {
w.Write(topic_alt_125) w.Write(topic_alt_125)
w.Write([]byte(strconv.Itoa(item.LikeCount))) }
w.Write(topic_alt_126) w.Write(topic_alt_126)
} if item.LikeCount > 0 {
w.Write(topic_alt_127) w.Write(topic_alt_127)
w.Write([]byte(item.RelativeCreatedAt)) w.Write([]byte(strconv.Itoa(item.LikeCount)))
w.Write(topic_alt_128) w.Write(topic_alt_128)
if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs { }
w.Write(topic_alt_129) w.Write(topic_alt_129)
w.Write([]byte(item.IPAddress)) w.Write([]byte(item.RelativeCreatedAt))
w.Write(topic_alt_130) w.Write(topic_alt_130)
w.Write([]byte(item.IPAddress)) if tmpl_topic_alt_vars.CurrentUser.Perms.ViewIPs {
w.Write(topic_alt_131) w.Write(topic_alt_131)
} w.Write([]byte(item.IPAddress))
w.Write(topic_alt_132) w.Write(topic_alt_132)
} w.Write([]byte(item.IPAddress))
w.Write(topic_alt_133) w.Write(topic_alt_133)
} }
}
w.Write(topic_alt_134) w.Write(topic_alt_134)
if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply { }
w.Write(topic_alt_135) w.Write(topic_alt_135)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar)) }
}
w.Write(topic_alt_136) w.Write(topic_alt_136)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link)) if tmpl_topic_alt_vars.CurrentUser.Perms.CreateReply {
w.Write(topic_alt_137) w.Write(topic_alt_137)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Name)) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Avatar))
w.Write(topic_alt_138) w.Write(topic_alt_138)
if tmpl_topic_alt_vars.CurrentUser.Tag != "" { w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Link))
w.Write(topic_alt_139) w.Write(topic_alt_139)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Tag)) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Name))
w.Write(topic_alt_140) w.Write(topic_alt_140)
} else { if tmpl_topic_alt_vars.CurrentUser.Tag != "" {
w.Write(topic_alt_141) w.Write(topic_alt_141)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level))) w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Tag))
w.Write(topic_alt_142) w.Write(topic_alt_142)
} } else {
w.Write(topic_alt_143) w.Write(topic_alt_143)
w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session)) w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.CurrentUser.Level)))
w.Write(topic_alt_144) w.Write(topic_alt_144)
w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID))) }
w.Write(topic_alt_145) w.Write(topic_alt_145)
if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles { w.Write([]byte(tmpl_topic_alt_vars.CurrentUser.Session))
w.Write(topic_alt_146) w.Write(topic_alt_146)
} w.Write([]byte(strconv.Itoa(tmpl_topic_alt_vars.Topic.ID)))
w.Write(topic_alt_147) w.Write(topic_alt_147)
} if tmpl_topic_alt_vars.CurrentUser.Perms.UploadFiles {
w.Write(topic_alt_148) w.Write(topic_alt_148)
}
w.Write(topic_alt_149)
}
w.Write(topic_alt_150)
w.Write(footer_0) w.Write(footer_0)
w.Write([]byte(common.BuildWidget("footer",tmpl_topic_alt_vars.Header))) w.Write([]byte(common.BuildWidget("footer",tmpl_topic_alt_vars.Header)))
w.Write(footer_1) w.Write(footer_1)

View File

@ -7,6 +7,7 @@
<link href="/static/{{.}}" rel="stylesheet" type="text/css"> <link href="/static/{{.}}" rel="stylesheet" type="text/css">
{{end}} {{end}}
<script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="/static/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/static/chartist/chartist.min.js"></script>
{{range .Header.Scripts}} {{range .Header.Scripts}}
<script type="text/javascript" src="/static/{{.}}"></script> <script type="text/javascript" src="/static/{{.}}"></script>
{{end}} {{end}}

View File

@ -39,12 +39,12 @@
<label class="poll_option_label" for="poll_option_{{.ID}}"> <label class="poll_option_label" for="poll_option_{{.ID}}">
<div class="sel"></div> <div class="sel"></div>
</label> </label>
<span class="poll_option_text">{{.Value}}</span> <span id="poll_option_text_{{.ID}}" class="poll_option_text">{{.Value}}</span>
</div> </div>
{{end}} {{end}}
<div class="poll_buttons"> <div class="poll_buttons">
<button form="poll_{{.Poll.ID}}_form" class="poll_vote_button">Vote</button> <button form="poll_{{.Poll.ID}}_form" class="poll_vote_button">Vote</button>
<button class="poll_results_button">Results</button> <button class="poll_results_button" data-poll-id="{{.Poll.ID}}">Results</button>
<a href="#"><button class="poll_cancel_button">Cancel</button></a> <a href="#"><button class="poll_cancel_button">Cancel</button></a>
</div> </div>
</div> </div>

View File

@ -550,10 +550,17 @@ input[type=checkbox]:checked + label.poll_option_label .sel {
display: inline-block; display: inline-block;
margin-left: 3px; margin-left: 3px;
font-size: 15px; font-size: 15px;
/*font-weight: bold;*/
position: relative; position: relative;
top: -1px; top: -1px;
color: var(--light-text-color); color: var(--light-text-color);
} }
#poll_option_text_0 {
color: #d70206;
}
#poll_option_text_1 {
color: #f05b4f;
}
.poll_buttons { .poll_buttons {
display: flex; display: flex;
margin-top: 8px; margin-top: 8px;