full functionality
This commit is contained in:
parent
cbf18df53d
commit
86daf5b0f3
|
@ -5,6 +5,7 @@ const
|
||||||
baseTemplate*: string = staticRead "./templates/layout.mustache"
|
baseTemplate*: string = staticRead "./templates/layout.mustache"
|
||||||
browseTemplate*: string = staticRead "./templates/browse.mustache"
|
browseTemplate*: string = staticRead "./templates/browse.mustache"
|
||||||
errorTemplate*: string = staticRead "./templates/error.mustache"
|
errorTemplate*: string = staticRead "./templates/error.mustache"
|
||||||
|
channelTemplate*: string = staticRead "./templates/channel.mustache"
|
||||||
|
|
||||||
testTemplate*: string = """<p>hi!</p>"""
|
testTemplate*: string = """<p>hi!</p>"""
|
||||||
|
|
||||||
|
@ -80,8 +81,17 @@ routes:
|
||||||
var
|
var
|
||||||
channels = db.getAllRows(sql"select channel from quotes group by channel")
|
channels = db.getAllRows(sql"select channel from quotes group by channel")
|
||||||
ctx: Context = newContext()
|
ctx: Context = newContext()
|
||||||
|
channelList = newSeq[Context]()
|
||||||
|
|
||||||
renderMustache("channel list", testTemplate, ctx)
|
for row in channels.items():
|
||||||
|
var c = newContext()
|
||||||
|
c["name"] = row[0]
|
||||||
|
c["safe"] = row[0].replace("#", "hashtag-")
|
||||||
|
channelList.add c
|
||||||
|
|
||||||
|
ctx["channels"] = channelList
|
||||||
|
|
||||||
|
renderMustache("channel list", channelTemplate, ctx)
|
||||||
except:
|
except:
|
||||||
fail()
|
fail()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{{# quotes }}
|
{{# quotes }}
|
||||||
<div class="entries">
|
<div class="entries">
|
||||||
<h3><a href="/{{ channelsafe }}">{{channel}}</a> - #{{listid}} - {{time}}</h3>
|
<h3><a href="/{{ channelsafe }}/0">{{channel}}</a> - #{{listid}} - {{time}}</h3>
|
||||||
<p>({{nick}}) {{message}}</p>
|
<p>({{nick}}) {{message}}</p>
|
||||||
<small><i>Added by {{adder}}. <a href="/quotes/{{id}}">permalink</a></i></small>
|
<small><i>Added by {{adder}}. <a href="/quotes/{{id}}">permalink</a></i></small>
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<ul>
|
||||||
|
{{# channels }}
|
||||||
|
<li><a href="/{{ safe }}/0">{{ name }}</li>
|
||||||
|
{{/ channels }}
|
||||||
|
</ul>
|
|
@ -2,11 +2,11 @@
|
||||||
<title>quotes{{# title }} - {{ title }}{{/ title }}</title>
|
<title>quotes{{# title }} - {{ title }}{{/ title }}</title>
|
||||||
<link rel=stylesheet type=text/css href="/style.css">
|
<link rel=stylesheet type=text/css href="/style.css">
|
||||||
<div class=page>
|
<div class=page>
|
||||||
<h1>{{# title }}{{ title }}{{/ title }}</h1>
|
<h1>quotes - {{# title }}{{ title }}{{/ title }}</h1>
|
||||||
<div class=metanav>
|
<div class=metanav>
|
||||||
<a href="/">home</a>
|
<a href="/">home</a>
|
||||||
<a href="/channel">channel</a>
|
<a href="/channel">channel</a>
|
||||||
<a href="/submit">submit</a>
|
<!-- <a href="/submit">submit</a> -->
|
||||||
</div>
|
</div>
|
||||||
{{{ body }}}
|
{{{ body }}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue