view src/view_course.html.luan @ 33:7d9462ea03e3

add korean
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 Aug 2025 15:56:23 -0600
parents 176a182c02cf
children 3cd6f36c81d4
line wrap: on
line source

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