Mercurial Hosting > lang
comparison src/private/tools/courses.html.luan @ 66:2ff1f78bb13e
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 22 Aug 2025 07:25:35 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
65:ecb851fabd75 | 66:2ff1f78bb13e |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local ipairs = Luan.ipairs or error() | |
4 local Html = require "luan:Html.luan" | |
5 local html_encode = Html.encode or error() | |
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 Course = require "site:/lib/Course.luan" | |
12 local course_search = Course.search or error() | |
13 local Logging = require "luan:logging/Logging.luan" | |
14 local logger = Logging.logger "courses.html" | |
15 | |
16 | |
17 return function() | |
18 local courses = course_search( "type:course", "course_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>Courses</h1> | |
35 <table> | |
36 <% for _, course in ipairs(courses) do %> | |
37 <tr> | |
38 <td><%= course.language_name() %></td> | |
39 <td><a href="/view_course.html?course=<%=course.id%>"><%= course.name_html() %></a></td> | |
40 <td><%= html_encode(course.get_user().email) %></td> | |
41 </tr> | |
42 <% end %> | |
43 </table> | |
44 </div> | |
45 </body> | |
46 </html> | |
47 <% | |
48 end |