Mercurial Hosting > lang
diff 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 |
line wrap: on
line diff
--- a/src/view_course.html.luan Fri Aug 15 08:43:24 2025 +0900 +++ b/src/view_course.html.luan Fri Aug 15 09:33:29 2025 +0900 @@ -9,11 +9,15 @@ 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> @@ -40,7 +44,12 @@ <h3><%= course.language_name() %></h3> - <p><a href="new_chat.red?course=<%=course.id%>">New chat</a></p> + <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> <h4>AI system prompt</h4> <pre><%=html_encode(course.ai_system_prompt)%></pre>