4
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local pairs = Luan.pairs or error()
|
|
4 local ipairs = Luan.ipairs or error()
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
|
7 local Shared = require "site:/lib/Shared.luan"
|
|
8 local head = Shared.head or error()
|
|
9 local header = Shared.private_header or error()
|
|
10 local config = Shared.config or error()
|
|
11 local user_repos = Shared.user_repos or error()
|
|
12
|
|
13
|
|
14 return function()
|
|
15 Io.stdout = Http.response.text_writer()
|
|
16 %>
|
|
17 <!doctype html>
|
|
18 <html>
|
|
19 <head>
|
|
20 <% head() %>
|
|
21 <title>Mercurial All Users</title>
|
|
22 <script>
|
|
23 function deleteUser(name) {
|
|
24 if( confirm('Are you sure that you want to delete user "'+name+'"?') )
|
|
25 location = "delete_user.html?user="+name;
|
|
26 }
|
|
27 </script>
|
|
28 </head>
|
|
29 <body>
|
|
30 <% header() %>
|
|
31 <div content>
|
|
32 <h1>All Users</h1>
|
|
33 <% for user in pairs(config.users) do %>
|
|
34 <p>
|
|
35 <%=user%>
|
|
36 <% local repos = user_repos[user]
|
|
37 if repos == nil then %>
|
|
38 [] <a href="javascript:deleteUser('<%=user%>')">delete user</a>
|
|
39 <% else %>
|
|
40 [
|
|
41 <% for _, repo in ipairs(repos) do %>
|
|
42 <a href="/repo/<%=repo.name%>/"><%=repo.name%></a>
|
|
43 <% end %>
|
|
44 ]
|
|
45 <% end %>
|
|
46 </p>
|
|
47 <% end %>
|
|
48 </div>
|
|
49 </body>
|
|
50 </html>
|
|
51 <%
|
|
52 end
|