58
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local ipairs = Luan.ipairs or error()
|
|
4 local Io = require "luan:Io.luan"
|
|
5 local Http = require "luan:http/Http.luan"
|
|
6 local Shared = require "site:/lib/Shared.luan"
|
|
7 local head = Shared.head or error()
|
|
8 local header = Shared.header or error()
|
|
9 local Chat = require "site:/lib/Chat.luan"
|
|
10 local chat_search = Chat.search or error()
|
|
11 local Logging = require "luan:logging/Logging.luan"
|
|
12 local logger = Logging.logger "chats.html"
|
|
13
|
|
14
|
|
15 return function()
|
|
16 local chats = chat_search( "type:chat", "chat_updated desc" )
|
|
17 Io.stdout = Http.response.text_writer()
|
|
18 %>
|
|
19 <!doctype html>
|
|
20 <html lang="en">
|
|
21 <head>
|
|
22 <% head() %>
|
|
23 <style>
|
|
24 td {
|
|
25 padding: 8px 8px;
|
|
26 }
|
|
27 </style>
|
|
28 </head>
|
|
29 <body>
|
|
30 <% header() %>
|
|
31 <div content>
|
|
32 <h1>Chats</h1>
|
|
33 <table>
|
|
34 <% for _, chat in ipairs(chats) do %>
|
|
35 <tr>
|
|
36 <td><%= chat.language_name() %></td>
|
|
37 <td><a href="chat.html?chat=<%=chat.id%>"><%= chat.name_html() %></a></td>
|
|
38 </tr>
|
|
39 <% end %>
|
|
40 </table>
|
|
41 </div>
|
|
42 </body>
|
|
43 </html>
|
|
44 <%
|
|
45 end
|