mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-03 21:46:22 -07:00
Fix failing tests, move more inline CSS to global CSS files
This commit is contained in:
parent
b6e74272a5
commit
9fb08929b7
9 changed files with 118 additions and 115 deletions
|
@ -4,4 +4,21 @@
|
|||
|
||||
form#appeal-form * {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.banpage-block {
|
||||
margin: 0px 26px 0px 24px;
|
||||
|
||||
.section-body {
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#ban-info {
|
||||
float: left;
|
||||
}
|
||||
|
||||
img#banpage-image {
|
||||
float: right;
|
||||
margin: 4px 8px 8px 4px;
|
||||
}
|
||||
|
|
|
@ -567,6 +567,22 @@ form#appeal-form * {
|
|||
display: block;
|
||||
}
|
||||
|
||||
.banpage-block {
|
||||
margin: 0px 26px 0px 24px;
|
||||
}
|
||||
.banpage-block .section-body {
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
#ban-info {
|
||||
float: left;
|
||||
}
|
||||
|
||||
img#banpage-image {
|
||||
float: right;
|
||||
margin: 4px 8px 8px 4px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-top: 50px;
|
||||
text-align: center;
|
||||
|
|
|
@ -122,11 +122,12 @@ func BuildFrontPage() error {
|
|||
// of every normal HTML page
|
||||
func BuildPageHeader(writer io.Writer, pageTitle string, board string, misc map[string]interface{}) error {
|
||||
phMap := map[string]interface{}{
|
||||
"pageTitle": pageTitle,
|
||||
"siteConfig": config.GetSiteConfig(),
|
||||
"sections": gcsql.AllSections,
|
||||
"boards": gcsql.AllBoards,
|
||||
"boardConfig": config.GetBoardConfig(board),
|
||||
"pageTitle": pageTitle,
|
||||
"documentTitle": pageTitle + " - " + config.GetSiteConfig().SiteName,
|
||||
"siteConfig": config.GetSiteConfig(),
|
||||
"sections": gcsql.AllSections,
|
||||
"boards": gcsql.AllBoards,
|
||||
"boardConfig": config.GetBoardConfig(board),
|
||||
}
|
||||
for k, val := range misc {
|
||||
phMap[k] = val
|
||||
|
|
|
@ -109,16 +109,7 @@ func doFrontBuildingTest(t *testing.T, mock sqlmock.Sqlmock, expectOut string) {
|
|||
WillReturnRows(sqlmock.NewRows([]string{"id", "name", "abbreviation", "position", "hidden"}).
|
||||
AddRows([]driver.Value{1, "Main", "main", 1, false}))
|
||||
|
||||
mock.ExpectPrepare(`SELECT\s*posts.id,\s*posts.message_raw,\s*` +
|
||||
`\(SELECT dir FROM boards WHERE id = t.board_id\),\s*` +
|
||||
`COALESCE\(f.filename, ''\), op.id\s*` +
|
||||
`FROM posts\s*` +
|
||||
`LEFT JOIN\s*\(SELECT id, board_id FROM threads\) t ON t.id = posts.thread_id\s+` +
|
||||
`LEFT JOIN\s*\(SELECT post_id, filename FROM files\) f on f.post_id = posts.id\s+` +
|
||||
`INNER JOIN\s*\(SELECT id, thread_id FROM posts WHERE is_top_post\) op ON op.thread_id = posts.thread_id\s+` +
|
||||
`WHERE posts.is_deleted = FALSE\s+` +
|
||||
`AND f.filename IS NOT NULL AND f.filename != '' AND f.filename != 'deleted'\s+` +
|
||||
`ORDER BY posts.id DESC LIMIT \d+`).ExpectQuery().WillReturnRows(
|
||||
mock.ExpectPrepare(`SELECT \* FROM v_front_page_posts_with_file ORDER BY id DESC LIMIT 15`).ExpectQuery().WillReturnRows(
|
||||
sqlmock.NewRows([]string{"posts.id", "posts.message_raw", "dir", "filename", "op.id"}).
|
||||
AddRows(
|
||||
[]driver.Value{1, "message_raw", "test", "filename", 1},
|
||||
|
|
|
@ -7,9 +7,9 @@ var defaultStyle = "test1.css";
|
|||
var webroot = "/chan";
|
||||
var serverTZ = 8;
|
||||
var fileTypes = [];`
|
||||
expectedMinifiedFront = `<!doctype html><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Gochan</title><link rel=stylesheet href=/chan/css/global.css><link id=theme rel=stylesheet href=/chan/css/test1.css><link rel="shortcut icon" href=/chan/favicon.png><script src=/chan/js/consts.js></script><script src=/chan/js/gochan.js></script><div id=topbar><div class=topbar-section><a href=/chan/ class=topbar-item>home</a></div><div class=topbar-section><a href=/chan/test/ class=topbar-item title="Testing board">/test/</a><a href=/chan/test2/ class=topbar-item title="Testing board 2">/test2/</a></div></div><div id=content><div id=top-pane><span id=site-title>Gochan</span><br><span id=site-slogan></span></div><br><div id=frontpage><div class=section-block style="margin: 16px 64px 16px 64px;"><div class="section-body front-intro">Welcome to Gochan!</div></div><div class=section-block><div class=section-title-block><b>Boards</b></div><div class=section-body><ul style="float:left; list-style: none"><li style="text-align: center; font-weight: bold"><b><u>Main</u></b><li><a href=/chan/test/ title="Board for testing description">/test/</a> — Testing board<li><a href=/chan/test2/ title="Board for testing description 2">/test2/</a> — Testing board 2</ul></div></div><div class=section-block><div class=section-title-block><b>Recent Posts</b></div><div class=section-body><div id=recent-posts><div class=recent-post><a href=/chan/test/res/1.html#1 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div><div class=recent-post><a href=/chan/test/res/1.html#2 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div></div></div></div></div><div id=footer>Powered by <a href=http://github.com/gochan-org/gochan/>Gochan 3.11</a><br></div></div>`
|
||||
expectedMinifiedFront = `<!doctype html><html lang=en><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Gochan</title><link rel=stylesheet href=/chan/css/global.css><link id=theme rel=stylesheet href=/chan/css/test1.css><link rel="shortcut icon" href=/chan/favicon.png><script src=/chan/js/consts.js></script><script src=/chan/js/gochan.js></script><div id=topbar><div class=topbar-section><a href=/chan/ class=topbar-item>home</a></div><div class=topbar-section><a href=/chan/test/ class=topbar-item title="Testing board">/test/</a><a href=/chan/test2/ class=topbar-item title="Testing board 2">/test2/</a></div></div><div id=content><div id=top-pane><h1 id=site-title>Gochan</h1><span id=site-slogan></span></div><br><div id=frontpage><div class=section-block style="margin: 16px 64px 16px 64px;"><div class="section-body front-intro">Welcome to Gochan!</div></div><div class=section-block><div class=section-title-block><b>Boards</b></div><div class=section-body><ul style="float:left; list-style: none"><li style="text-align: center; font-weight: bold"><b><u>Main</u></b><li><a href=/chan/test/ title="Board for testing description">/test/</a> — Testing board<li><a href=/chan/test2/ title="Board for testing description 2">/test2/</a> — Testing board 2</ul></div></div><div class=section-block><div class=section-title-block><b>Recent Posts</b></div><div class=section-body><div id=recent-posts><div class=recent-post><a href=/chan/test/res/1.html#1 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div><div class=recent-post><a href=/chan/test/res/1.html#2 class=front-reply target=_blank><img src=/chan/test/thumb alt="post thumbnail"></a><br><br><a href=/chan/test/>/test/</a><hr>message_raw</div></div></div></div></div><div id=footer>Powered by <a href=http://github.com/gochan-org/gochan/>Gochan 3.11</a><br></div></div>`
|
||||
expectedUnminifiedFront = `<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
@ -25,7 +25,7 @@ var fileTypes = [];`
|
|||
|
||||
<div id="content">
|
||||
<div id="top-pane">
|
||||
<span id="site-title">Gochan</span><br />
|
||||
<h1 id="site-title">Gochan</h1>
|
||||
<span id="site-slogan"></span>
|
||||
</div><br />
|
||||
<div id="frontpage">
|
||||
|
|
|
@ -28,11 +28,6 @@ func TestValidateValues(t *testing.T) {
|
|||
SetRandomSeed("test")
|
||||
assert.NoError(t, cfg.ValidateValues())
|
||||
|
||||
cfg.ListenIP = "not an IP"
|
||||
assert.Error(t, cfg.ValidateValues())
|
||||
cfg.ListenIP = "127.0.0.1"
|
||||
assert.NoError(t, cfg.ValidateValues())
|
||||
|
||||
cfg.CookieMaxAge = "not a duration"
|
||||
assert.Error(t, cfg.ValidateValues())
|
||||
cfg.CookieMaxAge = "1y"
|
||||
|
|
|
@ -10,6 +10,35 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const (
|
||||
headBeginning = `<!DOCTYPE html><html lang="en"><head>` +
|
||||
`<meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">`
|
||||
|
||||
headEndAndBodyStart = `<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script></head>` +
|
||||
`<body><div id="topbar"><div class="topbar-section"><a href="/"class="topbar-item">home</a></div></div>` +
|
||||
`<header><h1 id="board-title">Gochan</h1></header>` +
|
||||
`<div id="content"><div class="section-block banpage-block">`
|
||||
|
||||
normalBanHeader = headBeginning + `<title>YOU ARE BANNED:(</title>` + headEndAndBodyStart +
|
||||
`<div class="section-title-block"><span class="section-title ban-title">YOU ARE BANNED:(</span></div>` +
|
||||
`<div class="section-body"><div id="ban-info">`
|
||||
|
||||
bannedForeverHeader = headBeginning + `<title>YOU'RE PERMABANNED, IDIOT!</title>` + headEndAndBodyStart +
|
||||
`<div class="section-title-block"><span class="section-title ban-title">YOU'RE PERMABANNED,IDIOT!</span></div>` +
|
||||
`<div class="section-body"><div id="ban-info">`
|
||||
|
||||
appealForm = `<form id="appeal-form"action="/post"method="POST">` +
|
||||
`<input type="hidden"name="board"value=""><input type="hidden"name="banid"value="0">` +
|
||||
`<textarea rows="4"cols="48"name="appealmsg"id="postmsg"placeholder="Appeal message"></textarea>` +
|
||||
`<input type="submit"name="doappeal"value="Submit"/><br/></form>`
|
||||
|
||||
footer = `<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`
|
||||
)
|
||||
|
||||
var (
|
||||
testingSiteConfig = config.SiteConfig{
|
||||
SiteName: "Gochan",
|
||||
|
@ -64,24 +93,12 @@ var (
|
|||
DefaultStyle: "pipes.css",
|
||||
},
|
||||
},
|
||||
expectedOutput: `<!DOCTYPE html><html><head><title>Banned</title>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script></head>` +
|
||||
`<body><div id="top-pane"><span id="site-title">Gochan</span><br /><span id="site-slogan">Gochan test</span></div><br />` +
|
||||
`<div class="section-block"style="margin: 0px 26px 0px 24px">` +
|
||||
`<div class="section-title-block"><span class="section-title"><b>YOU ARE BANNED :(</b></span></div>` +
|
||||
`<div class="section-body"style="padding-top:8px"><div id="ban-info"style="float:left">You are banned from posting on<b>all boards</b>for the following reason:<br/><br/>` +
|
||||
`<b>ban message goes here</b><br/><br/>` +
|
||||
`Your ban was placed on Mon,January 01,0001 12:00:00 AM and will<b>not expire</b>.<br />` +
|
||||
`Your IP address is<b>192.168.56.1</b>.<br /><br/>You may appeal this ban:<br/>` +
|
||||
`<form id="appeal-form"action="/post"method="POST">` +
|
||||
`<input type="hidden"name="board"value=""><input type="hidden"name="banid"value="0">` +
|
||||
`<textarea rows="4"cols="48"name="appealmsg"id="postmsg"placeholder="Appeal message"></textarea><br />` +
|
||||
`<input type="submit"name="doappeal"value="Submit"/><br/></form></div></div></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
expectedOutput: normalBanHeader +
|
||||
`You are banned from posting on<span class="ban-boards">all boards</span>for the following reason:<p class="reason">ban message goes here</p>` +
|
||||
`Your ban was placed on<time datetime="0001-01-01T00:00:00Z"class="ban-timestamp">Mon,January 01,0001 12:00:00 AM</time> and will <span class="ban-timestamp">not expire</span>.<br/>` +
|
||||
`Your IP address is<span class="ban-ip">192.168.56.1</span>.<br /><br/>` +
|
||||
`You may appeal this ban:<br/>` + appealForm + `</div></div></div>` +
|
||||
footer,
|
||||
},
|
||||
{
|
||||
desc: "unappealable permaban (banned forever)",
|
||||
|
@ -105,22 +122,14 @@ var (
|
|||
DefaultStyle: "pipes.css",
|
||||
},
|
||||
},
|
||||
expectedOutput: `<!DOCTYPE html><html><head><title>Banned</title>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script></head>` +
|
||||
`<body><div id="top-pane"><span id="site-title">Gochan</span><br /><span id="site-slogan">Gochan test</span></div><br />` +
|
||||
`<div class="section-block"style="margin: 0px 26px 0px 24px"><div class="section-title-block">` +
|
||||
`<span class="section-title"><b>YOUR'E PERMABANNED,IDIOT!</b></span></div>` +
|
||||
`<div class="section-body"style="padding-top:8px"><div id="ban-info"style="float:left">You are banned from posting on<b>all boards</b>for the following reason:<br/><br/>` +
|
||||
`<b>ban message goes here</b><br/><br/>Your ban was placed on Mon,January 01,0001 12:00:00 AM and will<b>not expire</b>.<br />` +
|
||||
`Your IP address is<b>192.168.56.1</b>.<br /><br/>You may <b>not</b> appeal this ban.<br /></div>` +
|
||||
`<img id="banpage-image"src="/permabanned.jpg"style="float:right; margin: 4px 8px 8px 4px"/><br/>` +
|
||||
expectedOutput: bannedForeverHeader + `You are banned from posting on<span class="ban-boards">all boards</span>for the following reason:` +
|
||||
`<p class="reason">ban message goes here</p>Your ban was placed on<time datetime="0001-01-01T00:00:00Z"class="ban-timestamp">Mon,January 01,0001 12:00:00 AM</time> ` +
|
||||
`and will <span class="ban-timestamp">not expire</span>.<br/>` +
|
||||
`Your IP address is<span class="ban-ip">192.168.56.1</span>.<br /><br/>You may<span class="ban-timestamp">not</span> appeal this ban.<br /></div>` +
|
||||
`<img id="banpage-image" src="/static/permabanned.jpg"/><br/>` +
|
||||
`<audio id="jack"preload="auto"autobuffer loop><source src="/static/hittheroad.ogg"/><source src="/static/hittheroad.wav"/><source src="/static/hittheroad.mp3"/></audio>` +
|
||||
`<script type="text/javascript">document.getElementById("jack").play();</script></div></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
footer,
|
||||
},
|
||||
{
|
||||
desc: "appealable temporary ban",
|
||||
|
@ -143,24 +152,8 @@ var (
|
|||
DefaultStyle: "pipes.css",
|
||||
},
|
||||
},
|
||||
expectedOutput: `<!DOCTYPE html><html><head><title>Banned</title>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script></head>` +
|
||||
`<body><div id="top-pane"><span id="site-title">Gochan</span><br /><span id="site-slogan">Gochan test</span></div><br />` +
|
||||
`<div class="section-block"style="margin: 0px 26px 0px 24px">` +
|
||||
`<div class="section-title-block"><span class="section-title"><b>YOU ARE BANNED :(</b></span></div>` +
|
||||
`<div class="section-body"style="padding-top:8px"><div id="ban-info"style="float:left">You are banned from posting on<b>all boards</b>for the following reason:<br/><br/>` +
|
||||
`<b>ban message goes here</b><br/><br/>` +
|
||||
`Your ban was placed on Mon,January 01,0001 12:00:00 AM and will expire on <b>Mon,January 01,0001 12:00:00 AM</b>.<br />` +
|
||||
`Your IP address is<b>192.168.56.1</b>.<br /><br/>You may appeal this ban:<br/>` +
|
||||
`<form id="appeal-form"action="/post"method="POST">` +
|
||||
`<input type="hidden"name="board"value=""><input type="hidden"name="banid"value="0">` +
|
||||
`<textarea rows="4"cols="48"name="appealmsg"id="postmsg"placeholder="Appeal message"></textarea><br />` +
|
||||
`<input type="submit"name="doappeal"value="Submit"/><br/></form></div></div></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
expectedOutput: normalBanHeader +
|
||||
`You are banned from posting on<span class="ban-boards">all boards</span>for the following reason:<p class="reason">ban message goes here</p>Your ban was placed on<time datetime="0001-01-01T00:00:00Z"class="ban-timestamp">Mon,January 01,0001 12:00:00 AM</time> and will expire on <time class="ban-timestamp" datetime="0001-01-01T00:00:00Z">Mon, January 01, 0001 12:00:00 AM</time>.<br/>Your IP address is<span class="ban-ip">192.168.56.1</span>.<br /><br/>You may appeal this ban:<br/><form id="appeal-form"action="/post"method="POST"><input type="hidden"name="board"value=""><input type="hidden"name="banid"value="0"><textarea rows="4"cols="48"name="appealmsg"id="postmsg"placeholder="Appeal message"></textarea><input type="submit"name="doappeal"value="Submit"/><br/></form></div></div></div><div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
},
|
||||
{
|
||||
desc: "unappealable temporary ban",
|
||||
|
@ -182,21 +175,12 @@ var (
|
|||
DefaultStyle: "pipes.css",
|
||||
},
|
||||
},
|
||||
expectedOutput: `<!DOCTYPE html><html><head><title>Banned</title>` +
|
||||
`<link rel="shortcut icon"href="/favicon.png">` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/>` +
|
||||
`<link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
`<script type="text/javascript"src="/js/consts.js"></script>` +
|
||||
`<script type="text/javascript"src="/js/gochan.js"></script></head>` +
|
||||
`<body><div id="top-pane"><span id="site-title">Gochan</span><br /><span id="site-slogan">Gochan test</span></div><br />` +
|
||||
`<div class="section-block"style="margin: 0px 26px 0px 24px">` +
|
||||
`<div class="section-title-block"><span class="section-title"><b>YOU ARE BANNED :(</b></span></div>` +
|
||||
`<div class="section-body"style="padding-top:8px"><div id="ban-info"style="float:left">You are banned from posting on<b>all boards</b>for the following reason:<br/><br/>` +
|
||||
`<b>ban message goes here</b><br/><br/>` +
|
||||
`Your ban was placed on Mon,January 01,0001 12:00:00 AM and will expire on <b>Mon,January 01,0001 12:00:00 AM</b>.<br />` +
|
||||
`Your IP address is<b>192.168.56.1</b>.<br /><br/>You may <b>not</b> appeal this ban.<br />` +
|
||||
`</div></div></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
expectedOutput: normalBanHeader + `You are banned from posting on<span class="ban-boards">all boards</span>for the following reason:` +
|
||||
`<p class="reason">ban message goes here</p>` +
|
||||
`Your ban was placed on<time datetime="0001-01-01T00:00:00Z"class="ban-timestamp">Mon,January 01,0001 12:00:00 AM</time> ` +
|
||||
`and will expire on <time class="ban-timestamp" datetime="0001-01-01T00:00:00Z">Mon, January 01, 0001 12:00:00 AM</time>.<br/>` +
|
||||
`Your IP address is<span class="ban-ip">192.168.56.1</span>.<br /><br/>You may<span class="ban-timestamp">not</span> appeal this ban.<br />` +
|
||||
`</div></div></div>` + footer,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -213,7 +197,7 @@ var (
|
|||
},
|
||||
expectedOutput: boardPageHeaderBase +
|
||||
`<form action="/util"method="POST"id="main-form"><div id="right-bottom-content"><div id="report-delbox"><input type="hidden"name="board"value="test"/><input type="hidden"name="boardid"value="1"/><label>[<input type="checkbox"name="fileonly"/>File only]</label> <input type="password" size="10" name="password" id="delete-password" /><input type="submit"name="delete_btn"value="Delete"onclick="return confirm('Are you sure you want to delete these posts?')"/><br/>Report reason:<input type="text"size="10"name="reason"id="reason"/><input type="submit"name="report_btn"value="Report"/><br/><input type="submit"name="edit_btn"value="Edit post"/> <input type="submit"name="move_btn"value="Move thread"/></div></div></form><div id="left-bottom-content"><a href="#">Scroll to top</a><br/><table id="pages"><tr><td>[<a href="/test/1.html">1</a>]</td></tr></table><span id="boardmenu-bottom">[<a href="/">home</a>] []</span></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
footer,
|
||||
},
|
||||
{
|
||||
desc: "base case, multi threads and pages",
|
||||
|
@ -227,7 +211,7 @@ var (
|
|||
},
|
||||
expectedOutput: boardPageHeaderBase +
|
||||
`<form action="/util"method="POST"id="main-form"><div id="right-bottom-content"><div id="report-delbox"><input type="hidden"name="board"value="test"/><input type="hidden"name="boardid"value="1"/><label>[<input type="checkbox"name="fileonly"/>File only]</label> <input type="password" size="10" name="password" id="delete-password" /><input type="submit"name="delete_btn"value="Delete"onclick="return confirm('Are you sure you want to delete these posts?')"/><br/>Report reason:<input type="text"size="10"name="reason"id="reason"/><input type="submit"name="report_btn"value="Report"/><br/><input type="submit"name="edit_btn"value="Edit post"/> <input type="submit"name="move_btn"value="Move thread"/></div></div></form><div id="left-bottom-content"><a href="#">Scroll to top</a><br/><table id="pages"><tr><td>[<a href="/test/1.html">1</a>]</td></tr></table><span id="boardmenu-bottom">[<a href="/">home</a>] []</span></div>` +
|
||||
`<div id="footer">Powered by<a href="http://github.com/gochan-org/gochan/">Gochan 4.0</a><br /></div></div></body></html>`,
|
||||
footer,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -270,7 +254,7 @@ var (
|
|||
)
|
||||
|
||||
const (
|
||||
boardPageHeaderBase = `<!DOCTYPE html><html><head>` +
|
||||
boardPageHeaderBase = `<!DOCTYPE html><html lang="en"><head>` +
|
||||
`<meta charset="UTF-8"><meta name="viewport"content="width=device-width, initial-scale=1.0">` +
|
||||
`<title>/test/-Testing board</title>` +
|
||||
`<link rel="stylesheet"href="/css/global.css"/><link id="theme"rel="stylesheet"href="/css/pipes.css"/>` +
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{{- template "page_header.html" map "global" . "pageTitle" $.siteConfig.SiteName "boardConfig" $.boardConfig "siteConfig" $.siteConfig "boards" $.boards "sections" $.sections}}
|
||||
<div class="section-block" style="margin: 0px 26px 0px 24px">
|
||||
{{- template "page_header.html" map "global" . "pageTitle" $.siteConfig.SiteName "boardConfig" $.boardConfig "siteConfig" $.siteConfig "boards" $.boards "sections" $.sections "ban" $.ban}}
|
||||
<div class="section-block banpage-block">
|
||||
<div class="section-title-block">
|
||||
<span class="section-title"><span class="ban-title">{{if .ban.BannedForever}}YOUR'E PERMABANNED, IDIOT!{{else}}YOU ARE BANNED :({{end}}</span></span>
|
||||
<span class="section-title ban-title">{{if (.ban.BannedForever)}}YOU'RE PERMABANNED, IDIOT!{{else}}YOU ARE BANNED :({{end}}</span>
|
||||
</div>
|
||||
<div class="section-body" style="padding-top:8px">
|
||||
<div id="ban-info" style="float:left">{{if .ban.IsGlobalBan}}
|
||||
<div class="section-body">
|
||||
<div id="ban-info">{{if .ban.IsGlobalBan}}
|
||||
You are banned from posting on <span class="ban-boards">all boards</span> for the following reason:{{else}}
|
||||
You are banned from posting on <span class="ban-boards">{{.board.Dir}}</span> for the following reason:{{end}}
|
||||
<p class="reason">{{.ban.Message}}</p>
|
||||
|
@ -23,7 +23,7 @@
|
|||
{{- else}}You may <span class="ban-timestamp">not</span> appeal this ban.<br />{{end}}
|
||||
</div>
|
||||
{{- if .ban.BannedForever -}}
|
||||
<img id="banpage-image" src="{{webPath `static/permabanned.jpg`}}" style="float:right; margin: 4px 8px 8px 4px"/><br />
|
||||
<img id="banpage-image" src="{{webPath `static/permabanned.jpg`}}"/><br />
|
||||
<audio id="jack" preload="auto" autobuffer loop>
|
||||
<source src="{{webPath `static/hittheroad.ogg`}}" />
|
||||
<source src="{{webPath `static/hittheroad.wav`}}" />
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
{{$title := ""}}
|
||||
{{with .board}}
|
||||
{{with $.op}}
|
||||
{{$title = .TitleText}}
|
||||
{{else}}
|
||||
{{$title = print "/" $.board.Dir "/ - " $.board.Title}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{with $.pageTitle}}
|
||||
{{$title = print $.pageTitle " - "}}
|
||||
{{end}}
|
||||
{{$title = print $title $.siteConfig.SiteName}}
|
||||
{{end -}}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{$title}}</title>
|
||||
<title>{{with .ban -}}
|
||||
{{if .BannedForever}}YOU'RE PERMABANNED, IDIOT!{{else}}YOU ARE BANNED :({{end}}
|
||||
{{- else -}}
|
||||
{{- with .board -}}
|
||||
{{- with $.op}}{{.TitleText}}{{else}}/{{$.board.Dir}}/ - {{$.board.Title}}{{end -}}
|
||||
{{- else -}}
|
||||
{{- with $.documentTitle}}documentTitle: {{.}}
|
||||
{{- else -}}
|
||||
{{- with $.pageTitle -}}{{$.pageTitle}} - {{$.siteConfig.SiteName}}
|
||||
{{else}}{{$.siteConfig.SiteName}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end}}</title>
|
||||
<link rel="stylesheet" href="{{webPath "/css/global.css"}}" />
|
||||
{{with .board -}}
|
||||
<link id="theme" rel="stylesheet" href="{{webPath "/css/" (getBoardDefaultStyle $.board.Dir)}}" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue