Mercurial Hosting > freedit
comparison src/index.html.luan @ 9:9674275019bb
reply and edit
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 30 Jun 2022 00:02:28 -0600 |
parents | be36282b556a |
children |
comparison
equal
deleted
inserted
replaced
8:be36282b556a | 9:9674275019bb |
---|---|
1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | 2 local error = Luan.error |
3 local ipairs = Luan.ipairs or error() | |
3 local Io = require "luan:Io.luan" | 4 local Io = require "luan:Io.luan" |
4 local Http = require "luan:http/Http.luan" | 5 local Http = require "luan:http/Http.luan" |
5 local Shared = require "site:/lib/Shared.luan" | 6 local Shared = require "site:/lib/Shared.luan" |
6 local head = Shared.head or error() | 7 local head = Shared.head or error() |
7 local header = Shared.header or error() | 8 local header = Shared.header or error() |
8 local footer = Shared.footer or error() | 9 local footer = Shared.footer or error() |
9 local Forum = require "site:/lib/Forum.luan" | 10 local Forum = require "site:/lib/Forum.luan" |
10 local forum_title = Forum.title or error() | 11 local forum_title = Forum.title or error() |
12 local Db = require "site:/lib/Db.luan" | |
13 local Post = require "site:/lib/Post.luan" | |
11 | 14 |
12 | 15 |
13 return function() | 16 return function() |
17 local docs, total_hits = Db.search("post_is_root:true",1,1000,{sort="id desc"}) | |
18 local posts = Post.from_docs(docs) | |
14 Io.stdout = Http.response.text_writer() | 19 Io.stdout = Http.response.text_writer() |
15 %> | 20 %> |
16 <!doctype html> | 21 <!doctype html> |
17 <html> | 22 <html> |
18 <head> | 23 <head> |
21 </head> | 26 </head> |
22 <body> | 27 <body> |
23 <% header() %> | 28 <% header() %> |
24 <div content> | 29 <div content> |
25 <p><a href="/new_thread.html">New Thread</a></p> | 30 <p><a href="/new_thread.html">New Thread</a></p> |
31 <% for _, post in ipairs(posts) do %> | |
32 <p><a href="/thread.html?root=<%=post.id%>"><%=post.subject_html%></a></p> | |
33 <% end %> | |
26 </div> | 34 </div> |
27 <% footer() %> | 35 <% footer() %> |
28 </body> | 36 </body> |
29 </html> | 37 </html> |
30 <% | 38 <% |