Mercurial Hosting > freedit
view src/index.html.luan @ 48:4e1a01db19ec
add lists
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 17 Nov 2022 00:11:44 -0700 |
parents | 9674275019bb |
children |
line wrap: on
line source
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" local head = Shared.head or error() local header = Shared.header or error() 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> <html> <head> <% head() %> <title><%=forum_title%></title> </head> <body> <% 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> </html> <% end