Mercurial Hosting > freedit
diff 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 |
line wrap: on
line diff
--- a/src/index.html.luan Wed Jun 29 00:04:09 2022 -0600 +++ b/src/index.html.luan Thu Jun 30 00:02:28 2022 -0600 @@ -1,5 +1,6 @@ local Luan = require "luan:Luan.luan" local error = Luan.error +local ipairs = Luan.ipairs or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" @@ -8,9 +9,13 @@ local footer = Shared.footer or error() local Forum = require "site:/lib/Forum.luan" local forum_title = Forum.title or error() +local Db = require "site:/lib/Db.luan" +local Post = require "site:/lib/Post.luan" return function() + local docs, total_hits = Db.search("post_is_root:true",1,1000,{sort="id desc"}) + local posts = Post.from_docs(docs) Io.stdout = Http.response.text_writer() %> <!doctype html> @@ -23,6 +28,9 @@ <% header() %> <div content> <p><a href="/new_thread.html">New Thread</a></p> +<% for _, post in ipairs(posts) do %> + <p><a href="/thread.html?root=<%=post.id%>"><%=post.subject_html%></a></p> +<% end %> </div> <% footer() %> </body>