From 08961fa62a47229e0188b065d60c7875e427a054 Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Tue, 15 Sep 2020 20:25:58 +0200 Subject: [PATCH] render verenigingen projecten and konventen with the same detail layout --- Rules | 12 ++---------- layouts/{partials => }/detail.erb | 8 ++++++++ layouts/konvent.erb | 7 ------- layouts/vereniging.erb | 7 ------- lib/helpers/verenigingen.rb | 4 ++++ 5 files changed, 14 insertions(+), 24 deletions(-) rename layouts/{partials => }/detail.erb (89%) delete mode 100644 layouts/konvent.erb delete mode 100644 layouts/vereniging.erb diff --git a/Rules b/Rules index 20bafd5..3bc827f 100644 --- a/Rules +++ b/Rules @@ -14,17 +14,9 @@ preprocess do end end -compile '/{verenigingen,projecten}/*.md' do +compile '/{verenigingen,projecten,konventen}/*.md' do filter :kramdown - layout '/vereniging.*' - layout '/default.*' - layout '/base.*' - write ext: 'html' -end - -compile '/konventen/*.md' do - filter :kramdown - layout '/konvent.*' + layout '/detail.*' layout '/default.*' layout '/base.*' write ext: 'html' diff --git a/layouts/partials/detail.erb b/layouts/detail.erb similarity index 89% rename from layouts/partials/detail.erb rename to layouts/detail.erb index 99f61a5..9020da6 100644 --- a/layouts/partials/detail.erb +++ b/layouts/detail.erb @@ -1,3 +1,4 @@ +

<%= item[:naam] %>

@@ -52,3 +53,10 @@ <% end %> <% end %> +<% if item.path.include? "konventen" %> + <% for vereniging in verenigingen_voor_konvent(item[:id]) %> +
+ <%= vereniging[:naam] %> +
+ <% end %> +<% end %> diff --git a/layouts/konvent.erb b/layouts/konvent.erb deleted file mode 100644 index 6cad0e0..0000000 --- a/layouts/konvent.erb +++ /dev/null @@ -1,7 +0,0 @@ -

<%= item[:naam] %>

-
-
- <%= yield %> -
- <%= render '/partials/detail.*' %> -
diff --git a/layouts/vereniging.erb b/layouts/vereniging.erb deleted file mode 100644 index b111144..0000000 --- a/layouts/vereniging.erb +++ /dev/null @@ -1,7 +0,0 @@ -

<%= item[:naam] %>

-
-
- <%= yield %> -
- <%= render '/partials/detail.*' %> -
diff --git a/lib/helpers/verenigingen.rb b/lib/helpers/verenigingen.rb index 4d6e2fa..92b9c6c 100644 --- a/lib/helpers/verenigingen.rb +++ b/lib/helpers/verenigingen.rb @@ -20,6 +20,10 @@ module VerenigingenHelper @items.filter{|i| i[:themas] and i[:themas].include?(thema)}.to_a end + def verenigingen_voor_konvent(konvent) + @items.find_all("**/verenigingen/*").filter { |i| i[:konvent] == konvent }.to_a + end + def konventen @items.find_all("**/konventen/*").to_a end