Merge branch 'Quiz' of github.ugent.be:ZeusWPI/durfdoen-2.0 into Quiz
This commit is contained in:
commit
4b335adf1d
2 changed files with 21 additions and 16 deletions
|
@ -1,19 +1,22 @@
|
|||
<h1> <%= question[:vraag] %> </h1>
|
||||
|
||||
<select id="<%= question[:vraag] %>">
|
||||
<% for a in question[:antwoord] %>
|
||||
<option value="empty">Selecteer een optie...</option>
|
||||
<% for a in question[:antwoorden] %>
|
||||
<option value="<%= a[:tekst] %>"><%= a[:tekst] %></option>
|
||||
<% if a.key?("vraag") %>
|
||||
<div id=<%= a[:vraag]%>>
|
||||
<%= render '/partials/question.*', question: a %>
|
||||
<% if a[:vraag]%>
|
||||
<div id="<% a[:vraag]%>">
|
||||
<%#= render '/partials/question.*', question: a %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
|
||||
<div id="subquestion">
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById(<%= item[:vraag]%>).addEventListener('change', (event) => {
|
||||
var tekst = event.target.value;
|
||||
document.getElementById(<%= item[:vraag]%>)
|
||||
<%= render '/partials/question.*' %>
|
||||
console.log("test");
|
||||
document.getElementById("<%= question[:vraag] %>").addEventListener('change', (event) => {
|
||||
console.log("change");
|
||||
document.getElementById("subquestion").innerHTML = "<p>test</p>";
|
||||
})
|
||||
</script>
|
|
@ -1,10 +1,12 @@
|
|||
<h1>Hallo</h1>
|
||||
<ul>
|
||||
<% @items.find_all("**/quiz/*").each_with_index do |quest, i| %>
|
||||
<div id="question_<%=i%>" class="question">
|
||||
<h2> <%= quest[:vraag] %> </h2>
|
||||
<%= render '/partials/question.*', question: quest %>
|
||||
|
||||
<% @items.find_all("**/quiz/*").each_with_index do |x, i| %>
|
||||
<div id="question<%i%>" class="quistion">
|
||||
<%= render '/partials/question.*', question: x %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
<%= yield %>
|
||||
<%#= yield %>
|
||||
|
|
Loading…
Reference in a new issue