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