comparison src/view_course.html.luan @ 53:6c78fd83518f

add delete course
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 17 Aug 2025 16:59:37 +0900
parents 27758f3b2d69
children 285029931499
comparison
equal deleted inserted replaced
52:27758f3b2d69 53:6c78fd83518f
5 local Io = require "luan:Io.luan" 5 local Io = require "luan:Io.luan"
6 local Http = require "luan:http/Http.luan" 6 local Http = require "luan:http/Http.luan"
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 started = Shared.started or error()
10 local Course = require "site:/lib/Course.luan" 11 local Course = require "site:/lib/Course.luan"
11 local get_course_by_id = Course.get_by_id or error() 12 local get_course_by_id = Course.get_by_id or error()
12 local User = require "site:/lib/User.luan" 13 local User = require "site:/lib/User.luan"
13 local current_user = User.current or error() 14 local current_user = User.current or error()
14 15
28 h4 { 29 h4 {
29 margin-top: 22px; 30 margin-top: 22px;
30 margin-bottom: 4px; 31 margin-bottom: 4px;
31 } 32 }
32 </style> 33 </style>
34 <script src="/course.js?s=<%=started%>"></script>
33 </head> 35 </head>
34 <body> 36 <body>
35 <% header() %> 37 <% header() %>
36 <div content> 38 <div content>
37 <input type=hidden name=language value="<%=course.language%>"> 39 <input type=hidden name=language value="<%=course.language%>">
46 48
47 <p> 49 <p>
48 <a href="new_chat.red?course=<%=course.id%>">New chat</a> 50 <a href="new_chat.red?course=<%=course.id%>">New chat</a>
49 <% if is_owner then %> 51 <% if is_owner then %>
50 - <a href="edit_course.html?course=<%=course.id%>">Edit</a> 52 - <a href="edit_course.html?course=<%=course.id%>">Edit</a>
53 - <a href="javascript:deleteCourse()">Delete</a>
51 <% end %> 54 <% end %>
52 </p> 55 </p>
53 56
54 <p><input type=checkbox name=has_ruby <%= course.has_ruby and "checked" or "" %> disabled> Has pronunciation like {japanese|romaji}</p> 57 <p><input type=checkbox name=has_ruby <%= course.has_ruby and "checked" or "" %> disabled> Has pronunciation like {japanese|romaji}</p>
55 58
61 64
62 <h4>Text to speech instructions</h4> 65 <h4>Text to speech instructions</h4>
63 <pre><%=html_encode(course.tts_instructions)%></pre> 66 <pre><%=html_encode(course.tts_instructions)%></pre>
64 67
65 </div> 68 </div>
69 <dialog delete>
70 <h2>Delete Course</h2>
71 <p>Are you sure that you want to delete this course?</p>
72 <div buttons>
73 <button onclick="closeModal(this)">Cancel</button>
74 <button onclick="doDeleteCourse(this,<%=course_id%>)">Delete</button>
75 </div>
76 </dialog>
66 </body> 77 </body>
67 </html> 78 </html>
68 <% 79 <%
69 end 80 end