Mercurial Hosting > lang
comparison src/view_course.html.luan @ 50:85c5f62070d8
misc
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 15 Aug 2025 09:33:29 +0900 |
parents | a119fc092f42 |
children | 27758f3b2d69 |
comparison
equal
deleted
inserted
replaced
49:97b0d206cacd | 50:85c5f62070d8 |
---|---|
7 local Shared = require "site:/lib/Shared.luan" | 7 local Shared = require "site:/lib/Shared.luan" |
8 local head = Shared.head or error() | 8 local head = Shared.head or error() |
9 local header = Shared.header or error() | 9 local header = Shared.header or error() |
10 local Course = require "site:/lib/Course.luan" | 10 local Course = require "site:/lib/Course.luan" |
11 local get_course_by_id = Course.get_by_id or error() | 11 local get_course_by_id = Course.get_by_id or error() |
12 local User = require "site:/lib/User.luan" | |
13 local current_user = User.current or error() | |
12 | 14 |
13 | 15 |
14 return function() | 16 return function() |
15 local course_id = Http.request.parameters.course | 17 local course_id = Http.request.parameters.course |
16 local course = get_course_by_id(course_id) or error() | 18 local course = get_course_by_id(course_id) or error() |
19 local user = current_user() | |
20 local is_owner = user ~= nil and user.id == course.user_id | |
17 Io.stdout = Http.response.text_writer() | 21 Io.stdout = Http.response.text_writer() |
18 %> | 22 %> |
19 <!doctype html> | 23 <!doctype html> |
20 <html lang="en"> | 24 <html lang="en"> |
21 <head> | 25 <head> |
38 | 42 |
39 <h2><%= course.name_html() %></h2> | 43 <h2><%= course.name_html() %></h2> |
40 | 44 |
41 <h3><%= course.language_name() %></h3> | 45 <h3><%= course.language_name() %></h3> |
42 | 46 |
43 <p><a href="new_chat.red?course=<%=course.id%>">New chat</a></p> | 47 <p> |
48 <a href="new_chat.red?course=<%=course.id%>">New chat</a> | |
49 <% if is_owner then %> | |
50 - <a href="edit_course.html?course=<%=course.id%>">Edit</a> | |
51 <% end %> | |
52 </p> | |
44 | 53 |
45 <h4>AI system prompt</h4> | 54 <h4>AI system prompt</h4> |
46 <pre><%=html_encode(course.ai_system_prompt)%></pre> | 55 <pre><%=html_encode(course.ai_system_prompt)%></pre> |
47 | 56 |
48 <h4>AI first message (optional)</h4> | 57 <h4>AI first message (optional)</h4> |