Mercurial Hosting > lang
view src/view_course.html.luan @ 52:27758f3b2d69
add hide_ruby
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 16 Aug 2025 09:56:10 +0900 |
parents | 85c5f62070d8 |
children | 6c78fd83518f |
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() local User = require "site:/lib/User.luan" local current_user = User.current or error() return function() local course_id = Http.request.parameters.course local course = get_course_by_id(course_id) or error() local user = current_user() local is_owner = user ~= nil and user.id == course.user_id 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> <p> <a href="new_chat.red?course=<%=course.id%>">New chat</a> <% if is_owner then %> - <a href="edit_course.html?course=<%=course.id%>">Edit</a> <% end %> </p> <p><input type=checkbox name=has_ruby <%= course.has_ruby and "checked" or "" %> disabled> Has pronunciation like {japanese|romaji}</p> <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)%></pre> <h4>Text to speech instructions</h4> <pre><%=html_encode(course.tts_instructions)%></pre> </div> </body> </html> <% end