Add top 20 quotes
This commit is contained in:
parent
aded75af95
commit
8b66e363b7
|
@ -162,6 +162,25 @@ routes:
|
|||
redirect "/quotes/" & row[0]
|
||||
except: fail()
|
||||
|
||||
get "/top":
|
||||
try:
|
||||
var
|
||||
rows = db.getAllRows(sql"SELECT * from quotes where deleted=0 and votes > 0 order by votes desc LIMIT 20")
|
||||
ctx = newContext()
|
||||
quoteSeq = newSeq[Context]()
|
||||
|
||||
for row in items(rows):
|
||||
var c = newContext()
|
||||
c.contextQuote row[0].parseInt(), row
|
||||
quoteSeq.add c
|
||||
|
||||
ctx["quotes"] = quoteSeq
|
||||
|
||||
renderMustache("top 20 quotes", browseTemplate, ctx)
|
||||
|
||||
except:
|
||||
fail()
|
||||
|
||||
get "/@kind/@id":
|
||||
var
|
||||
title: string = ""
|
||||
|
@ -183,7 +202,7 @@ routes:
|
|||
of "quotes":
|
||||
rows = db.getAllRows(sql"SELECT * FROM quotes WHERE id = ?", qid)
|
||||
|
||||
title = "quote #" & $qid & " by " & rows[0][2]
|
||||
title = "#" & $qid & " by " & rows[0][2]
|
||||
else:
|
||||
if (@"kind").startsWith "hashtag-":
|
||||
let channel = (@"kind").replace("hashtag-", "#")
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<div class=metanav>
|
||||
<a href="/">home</a>
|
||||
<a href="/channel">channel</a>
|
||||
<a href="/top">top</a>
|
||||
<a href="/submit">submit</a>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue