better questions

This commit is contained in:
ajuvercr 2020-02-27 22:45:50 +01:00
parent 2ae155b877
commit 2f9b80512d
3 changed files with 15 additions and 21 deletions

7
Rules
View file

@ -7,13 +7,6 @@ compile '/verenigingen/*.md' do
write ext: 'html'
end
compile '/quiz/*.md' do
filter :kramdown
layout '/partials/question.*'
layout '/default.*'
write ext: 'html'
end
compile '/homepage.md' do
filter :kramdown
layout '/homepage.*'

View file

@ -1,14 +1,15 @@
<h1> <%= item[:vraag] %> </h1>
<select id=<%= item[:vraag] %>>
<% for a in item[:antwoord] %>
<option value=<%= a[:teskt] %>><%= a[:tekst] %></option>
<% if a[:vraag] != ""%>
<div id=<% a[:vraag]%>>
<%= render '/partials/question.*' %>
<h1> <%= question[:vraag] %> </h1>
<select id="<%= question[:vraag] %>">
<% for a in question[:antwoord] %>
<option value="<%= a[:tekst] %>"><%= a[:tekst] %></option>
<% if a.key?("vraag") %>
<div id=<%= a[:vraag]%>>
<%= render '/partials/question.*', question: a %>
</div>
<% end %
<% end %>
<% end %>
</select>
<script>
document.getElementById(<%= item[:vraag]%>).addEventListener('change', (event) => {
var tekst = event.target.value;
@ -16,4 +17,3 @@
<%= render '/partials/question.*' %>
})
</script>
<%= yield %>

View file

@ -1,8 +1,9 @@
<h1>Hallo</h1>
<ul>
<% @items.find_all("**/quiz/*").each_with_index do |x, i| %>
<div id="question<%i%>" class="quistion">
<%= render '/partials/question.*', item: x %>
<% @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 %>
</div>
<% end %>
</ul>