Major bug fix
This commit is contained in:
37
drill-and-practice/views/question.eta
Normal file
37
drill-and-practice/views/question.eta
Normal file
@@ -0,0 +1,37 @@
|
||||
<% layout("./layouts/layout.eta") %>
|
||||
<h1>Question <%= it.id %>: <%= it.question_text %></h1>
|
||||
|
||||
<h2>All options:</h2>
|
||||
<% if (it.details && it.details.length > 0) { %>
|
||||
<% it.details.forEach((item) => { %>
|
||||
<p><form action="/topics/<%= it.topicId %>/questions/<%= it.id %>/options/<%= item.id %>/delete" method="POST">
|
||||
Content: <%= item.option_text %>; Correctness: <%= item.is_correct %>
|
||||
<input type="submit" value="Delete pption" />
|
||||
</form></p>
|
||||
<% }); %>
|
||||
<% } else { %>
|
||||
<p>No option available. Do you want to delete this question?</p>
|
||||
<form method="POST" action="/topics/<%= it.topicId %>/questions/<%= it.id %>/delete">
|
||||
<input type="submit" value="Delete Question"/>
|
||||
</form>
|
||||
<% } %>
|
||||
|
||||
<h2>Add an answer pption</h2>
|
||||
|
||||
<% if (it.errors) { %>
|
||||
<ul>
|
||||
<% Object.keys(it.errors).forEach((error) => { %>
|
||||
<% Object.values(it.errors[error]).forEach((err) => { %>
|
||||
<li><%= err %></li>
|
||||
<% }); %>
|
||||
<% }); %>
|
||||
</ul>
|
||||
<% } %>
|
||||
|
||||
<form method="POST" action="/topics/<%= it.topicId %>/questions/<%= it.id %>/options">
|
||||
Option:<br/>
|
||||
<textarea name="option_text"><%= it.optionText ? it.optionText : "" %></textarea><br/>
|
||||
Correct:
|
||||
<input type="checkbox" name="correct"/>
|
||||
<input type="submit" value="Add"/>
|
||||
</form>
|
||||
Reference in New Issue
Block a user