Mercurial Hosting > lang
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/view_course.html.luan Fri Aug 01 20:08:13 2025 -0600 @@ -0,0 +1,53 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.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 get_course_by_id = Course.get_by_id or error() + + +return function() + local course_id = Http.request.parameters.course + local course = get_course_by_id(course_id) or error() + Io.stdout = Http.response.text_writer() +%> +<!doctype html> +<html lang="en"> + <head> +<% head() %> + <style> + h4 { + margin-top: 22px; + margin-bottom: 4px; + } + </style> + </head> + <body> +<% header() %> + <div content> + <input type=hidden name=language value="<%=course.language%>"> +<% if course_id ~= nil then %> + <input type=hidden name=course value="<%=course_id%>"> +<% end %> + <h1>View Course</h1> + + <h2><%= course.name_html() %></h2> + + <h3><%= course.language_name() %></h3> + + <h4>AI system prompt</h4> + <pre><%=html_encode(course.ai_system_prompt)%></pre> + + <h4>AI first message (optional)</h4> + <pre><%=html_encode(course.ai_first_message or "")%></pre> + + </div> + </body> +</html> +<% +end