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>
|
<h1> <%= question[:vraag] %> </h1>
|
||||||
|
|
||||||
<select id="<%= question[:vraag] %>">
|
<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>
|
<option value="<%= a[:tekst] %>"><%= a[:tekst] %></option>
|
||||||
<% if a.key?("vraag") %>
|
<% if a[:vraag]%>
|
||||||
<div id=<%= a[:vraag]%>>
|
<div id="<% a[:vraag]%>">
|
||||||
<%= render '/partials/question.*', question: a %>
|
<%#= render '/partials/question.*', question: a %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
|
<div id="subquestion">
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById(<%= item[:vraag]%>).addEventListener('change', (event) => {
|
console.log("test");
|
||||||
var tekst = event.target.value;
|
document.getElementById("<%= question[:vraag] %>").addEventListener('change', (event) => {
|
||||||
document.getElementById(<%= item[:vraag]%>)
|
console.log("change");
|
||||||
<%= render '/partials/question.*' %>
|
document.getElementById("subquestion").innerHTML = "<p>test</p>";
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
<h1>Hallo</h1>
|
<h1>Hallo</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<% @items.find_all("**/quiz/*").each_with_index do |quest, i| %>
|
|
||||||
<div id="question_<%=i%>" class="question">
|
<% @items.find_all("**/quiz/*").each_with_index do |x, i| %>
|
||||||
<h2> <%= quest[:vraag] %> </h2>
|
<div id="question<%i%>" class="quistion">
|
||||||
<%= render '/partials/question.*', question: quest %>
|
<%= render '/partials/question.*', question: x %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<%= yield %>
|
<%#= yield %>
|
||||||
|
|
Loading…
Reference in a new issue