Mercurial Hosting > lang
comparison src/view_course.html.luan @ 27:176a182c02cf
add view_course
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 Aug 2025 20:08:13 -0600 |
parents | src/edit_course.html.luan@3a80ddafe5a4 |
children | 3cd6f36c81d4 |
comparison
equal
deleted
inserted
replaced
26:d3f5448743bf | 27:176a182c02cf |
---|---|
1 local Luan = require "luan:Luan.luan" | |
2 local error = Luan.error | |
3 local Html = require "luan:Html.luan" | |
4 local html_encode = Html.encode 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.header or error() | |
10 local Course = require "site:/lib/Course.luan" | |
11 local get_course_by_id = Course.get_by_id or error() | |
12 | |
13 | |
14 return function() | |
15 local course_id = Http.request.parameters.course | |
16 local course = get_course_by_id(course_id) or error() | |
17 Io.stdout = Http.response.text_writer() | |
18 %> | |
19 <!doctype html> | |
20 <html lang="en"> | |
21 <head> | |
22 <% head() %> | |
23 <style> | |
24 h4 { | |
25 margin-top: 22px; | |
26 margin-bottom: 4px; | |
27 } | |
28 </style> | |
29 </head> | |
30 <body> | |
31 <% header() %> | |
32 <div content> | |
33 <input type=hidden name=language value="<%=course.language%>"> | |
34 <% if course_id ~= nil then %> | |
35 <input type=hidden name=course value="<%=course_id%>"> | |
36 <% end %> | |
37 <h1>View Course</h1> | |
38 | |
39 <h2><%= course.name_html() %></h2> | |
40 | |
41 <h3><%= course.language_name() %></h3> | |
42 | |
43 <h4>AI system prompt</h4> | |
44 <pre><%=html_encode(course.ai_system_prompt)%></pre> | |
45 | |
46 <h4>AI first message (optional)</h4> | |
47 <pre><%=html_encode(course.ai_first_message or "")%></pre> | |
48 | |
49 </div> | |
50 </body> | |
51 </html> | |
52 <% | |
53 end |