From 9c6ffa9c990af13b6fdb40f9f52bf04c1aad879c Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Thu, 9 Nov 2023 18:10:20 +0100 Subject: [PATCH] fix --- app/models/communication/block/template/agenda.rb | 4 ++++ app/models/communication/block/template/base.rb | 4 ++++ app/models/communication/block/template/license.rb | 2 ++ app/models/communication/block/template/organization.rb | 4 ++++ app/models/communication/block/template/page.rb | 4 ++++ app/models/communication/block/template/person.rb | 4 ++++ app/models/communication/block/template/post.rb | 4 ++++ app/models/communication/block/template/program.rb | 4 ++++ app/models/communication/block/with_heading_ranks.rb | 2 +- 9 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/models/communication/block/template/agenda.rb b/app/models/communication/block/template/agenda.rb index 9442948a9..ddbd35eb2 100644 --- a/app/models/communication/block/template/agenda.rb +++ b/app/models/communication/block/template/agenda.rb @@ -27,6 +27,10 @@ class Communication::Block::Template::Agenda < Communication::Block::Template::B def allowed_for_about? website.present? end + + def children + selected_events + end protected diff --git a/app/models/communication/block/template/base.rb b/app/models/communication/block/template/base.rb index b241d11b2..8bc0ed6b9 100644 --- a/app/models/communication/block/template/base.rb +++ b/app/models/communication/block/template/base.rb @@ -141,6 +141,10 @@ class Communication::Block::Template::Base @full_text end + def children + false + end + def to_s self.class.to_s.demodulize end diff --git a/app/models/communication/block/template/license.rb b/app/models/communication/block/template/license.rb index a34d1f2fb..68928e995 100644 --- a/app/models/communication/block/template/license.rb +++ b/app/models/communication/block/template/license.rb @@ -1,8 +1,10 @@ class Communication::Block::Template::License < Communication::Block::Template::Base + has_component :description, :rich_text has_component :type, :option, options: [:creative_commons] has_component :creative_commons_attribution, :option, options: [:false, :true] has_component :creative_commons_commercial_use, :option, options: [:true, :false] has_component :creative_commons_derivatives, :option, options: [:true, :false] has_component :creative_commons_sharing, :option, options: [:true, :false] + end diff --git a/app/models/communication/block/template/organization.rb b/app/models/communication/block/template/organization.rb index 536f24452..ac33cfa56 100644 --- a/app/models/communication/block/template/organization.rb +++ b/app/models/communication/block/template/organization.rb @@ -18,4 +18,8 @@ class Communication::Block::Template::Organization < Communication::Block::Templ def organizations @organizations ||= elements.collect(&:organization).compact.uniq end + + def children + organizations + end end diff --git a/app/models/communication/block/template/page.rb b/app/models/communication/block/template/page.rb index 8ae847626..16a94047e 100644 --- a/app/models/communication/block/template/page.rb +++ b/app/models/communication/block/template/page.rb @@ -24,6 +24,10 @@ class Communication::Block::Template::Page < Communication::Block::Template::Bas def allowed_for_about? !website.nil? end + + def children + selected_pages + end protected diff --git a/app/models/communication/block/template/person.rb b/app/models/communication/block/template/person.rb index adada3cb3..9a01a2d60 100644 --- a/app/models/communication/block/template/person.rb +++ b/app/models/communication/block/template/person.rb @@ -14,4 +14,8 @@ class Communication::Block::Template::Person < Communication::Block::Template::B end @elements end + + def children + elements + end end diff --git a/app/models/communication/block/template/post.rb b/app/models/communication/block/template/post.rb index de2ad77e9..24c0ee8a6 100644 --- a/app/models/communication/block/template/post.rb +++ b/app/models/communication/block/template/post.rb @@ -21,6 +21,10 @@ class Communication::Block::Template::Post < Communication::Block::Template::Bas def allowed_for_about? !website.nil? end + + def children + selected_posts + end protected diff --git a/app/models/communication/block/template/program.rb b/app/models/communication/block/template/program.rb index a187c301e..d35d5f2c5 100644 --- a/app/models/communication/block/template/program.rb +++ b/app/models/communication/block/template/program.rb @@ -17,4 +17,8 @@ class Communication::Block::Template::Program < Communication::Block::Template:: def available_programs website.education_programs end + + def children + selected_programs + end end diff --git a/app/models/communication/block/with_heading_ranks.rb b/app/models/communication/block/with_heading_ranks.rb index e134f0ae8..33ea91848 100644 --- a/app/models/communication/block/with_heading_ranks.rb +++ b/app/models/communication/block/with_heading_ranks.rb @@ -15,7 +15,7 @@ module Communication::Block::WithHeadingRanks end def heading_children? - template.respond_to?(:elements) && template.elements.any? + template.children && template.children.any? end protected -- GitLab