From 2e0873446737d0b3227da9d7e7526779698f13a6 Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Thu, 19 Mar 2020 22:24:54 +0100 Subject: [PATCH] do cool shit, like live update things --- layouts/partials/group_small.erb | 1 + layouts/partials/question.erb | 2 +- layouts/quiz.erb | 43 ++++++++++++++++++++++++++------ lib/helpers/verenigingen.rb | 5 +++- 4 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 layouts/partials/group_small.erb diff --git a/layouts/partials/group_small.erb b/layouts/partials/group_small.erb new file mode 100644 index 0000000..784c9b6 --- /dev/null +++ b/layouts/partials/group_small.erb @@ -0,0 +1 @@ +<%= link_to group[:titel], group %> diff --git a/layouts/partials/question.erb b/layouts/partials/question.erb index b0c451c..86de685 100644 --- a/layouts/partials/question.erb +++ b/layouts/partials/question.erb @@ -62,7 +62,7 @@ // Update results save_answers(selected.flatMap(e => question_results[e] || [])); del_answers(last_answered.flatMap(e => question_results[e] || [])); - print_answers(); + finish_answers(); // Make possible sub question visible const quests = selected.flatMap(e => sub_questions[e] || []); diff --git a/layouts/quiz.erb b/layouts/quiz.erb index 1085d90..073bf96 100644 --- a/layouts/quiz.erb +++ b/layouts/quiz.erb @@ -1,7 +1,31 @@ +
+
+ <% @items.find_all("/quiz/*").each_with_index do |quest, i| %> +
+ <%= render '/partials/question.*', question: quest %> +
+ <% end %> +
+ +
+ <% all_groups().each do |group| %> + + <% end %> +
+
+ -<% @items.find_all("/quiz/*").each_with_index do |quest, i| %> -
- <%= render '/partials/question.*', question: quest %> -
-<% end %> <%= yield %> diff --git a/lib/helpers/verenigingen.rb b/lib/helpers/verenigingen.rb index 7ee51a7..21534de 100644 --- a/lib/helpers/verenigingen.rb +++ b/lib/helpers/verenigingen.rb @@ -11,4 +11,7 @@ module VerenigingenHelper def konvents @items.find_all("**/verenigingen/*").map{|x| x[:konvent]}.uniq.compact end - end \ No newline at end of file + def all_groups + @items.find_all("**/verenigingen/*") + @items.find_all("**/konventen/*") + end + end