Mercurial Hosting > lang
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/private/tools/courses.html.luan Fri Aug 22 07:25:35 2025 -0600 @@ -0,0 +1,48 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local ipairs = Luan.ipairs or error() +local Html = require "luan:Html.luan" +local html_encode = Html.encode or error() +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/lib/Shared.luan" +local head = Shared.head or error() +local header = Shared.header or error() +local Course = require "site:/lib/Course.luan" +local course_search = Course.search or error() +local Logging = require "luan:logging/Logging.luan" +local logger = Logging.logger "courses.html" + + +return function() + local courses = course_search( "type:course", "course_updated desc" ) + Io.stdout = Http.response.text_writer() +%> +<!doctype html> +<html lang="en"> + <head> +<% head() %> + <style> + td { + padding: 8px 8px; + } + </style> + </head> + <body> +<% header() %> + <div content> + <h1>Courses</h1> + <table> +<% for _, course in ipairs(courses) do %> + <tr> + <td><%= course.language_name() %></td> + <td><a href="/view_course.html?course=<%=course.id%>"><%= course.name_html() %></a></td> + <td><%= html_encode(course.get_user().email) %></td> + </tr> +<% end %> + </table> + </div> + </body> +</html> +<% +end