From cc183c7775063ee7231b77a19953d1a86b1374a9 Mon Sep 17 00:00:00 2001 From: Arthur Vercruysse Date: Sat, 5 Sep 2020 21:40:05 +0200 Subject: [PATCH] give quiz a nice post code handler --- layouts/base.erb | 3 +- layouts/partials/group_small.erb | 2 +- layouts/partials/question.erb | 77 +++++++++++++++++++------------- lib/helpers/verenigingen.rb | 11 ++++- 4 files changed, 58 insertions(+), 35 deletions(-) diff --git a/layouts/base.erb b/layouts/base.erb index 4278879..90b422c 100644 --- a/layouts/base.erb +++ b/layouts/base.erb @@ -1,14 +1,13 @@ - + Durf Doen! - <%= item[:naam] || abbreviation(item) %> - <%#= item[:head] %> diff --git a/layouts/partials/group_small.erb b/layouts/partials/group_small.erb index 784c9b6..61dad85 100644 --- a/layouts/partials/group_small.erb +++ b/layouts/partials/group_small.erb @@ -1 +1 @@ -<%= link_to group[:titel], group %> +<%= link_to group[:naam], group %> diff --git a/layouts/partials/question.erb b/layouts/partials/question.erb index c289619..8592bb7 100644 --- a/layouts/partials/question.erb +++ b/layouts/partials/question.erb @@ -3,8 +3,7 @@

Geef je postcode in

- - + <%else%> -<% end %> -<% for answer in question[:antwoorden]%> - <% if answer[:vraag] %> - + <% for answer in question[:antwoorden]%> + <% if answer[:vraag] %> + + <% end %> <% end %> <% end %> - diff --git a/lib/helpers/verenigingen.rb b/lib/helpers/verenigingen.rb index f5ee08b..d71defe 100644 --- a/lib/helpers/verenigingen.rb +++ b/lib/helpers/verenigingen.rb @@ -37,10 +37,19 @@ module VerenigingenHelper "naam" => x[:naam], "verkorte_naam" => x[:verkorte_naam], "konvent" => x[:konvent], - "themas" => x[:themas] + "themas" => x[:themas], + "postcodes" => x[:postcodes].to_a, } }.to_a end + def postcodes_per_vereniging + @items.find_all("**/verenigingen/*").map { |x| { + "postcodes" => x[:postcodes], + "id" => x[:id] + } }.flatten.to_a + end + + def abbreviation(item) item.identifier.without_ext.split('/').last end