annotate src/index.html.luan @ 26:0837820b97fb

tinymce work
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 20 Jul 2022 15:47:18 -0600
parents 9674275019bb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
9
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
3 local ipairs = Luan.ipairs or error()
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Io = require "luan:Io.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 local Http = require "luan:http/Http.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 local Shared = require "site:/lib/Shared.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 local head = Shared.head or error()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 local header = Shared.header or error()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 local footer = Shared.footer or error()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local Forum = require "site:/lib/Forum.luan"
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
11 local forum_title = Forum.title or error()
9
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
12 local Db = require "site:/lib/Db.luan"
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
13 local Post = require "site:/lib/Post.luan"
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 return function()
9
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
17 local docs, total_hits = Db.search("post_is_root:true",1,1000,{sort="id desc"})
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
18 local posts = Post.from_docs(docs)
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 Io.stdout = Http.response.text_writer()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 <!doctype html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 <html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 <head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <% head() %>
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
25 <title><%=forum_title%></title>
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 </head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 <body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 <% header() %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29 <div content>
8
be36282b556a add new_thread
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
30 <p><a href="/new_thread.html">New Thread</a></p>
9
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
31 <% for _, post in ipairs(posts) do %>
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
32 <p><a href="/thread.html?root=<%=post.id%>"><%=post.subject_html%></a></p>
9674275019bb reply and edit
Franklin Schmidt <fschmidt@gmail.com>
parents: 8
diff changeset
33 <% end %>
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 </div>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35 <% footer() %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 </body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 </html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 end