diff --git a/app/models/communication/block/template/base.rb b/app/models/communication/block/template/base.rb index 8bc0ed6b948a982a54bd2fa1d9b3573a518d894f..396c61b436a2864f34cd0e69d8b8fc7e38b095e2 100644 --- a/app/models/communication/block/template/base.rb +++ b/app/models/communication/block/template/base.rb @@ -145,6 +145,10 @@ class Communication::Block::Template::Base false end + def heading_title + block.title + end + def to_s self.class.to_s.demodulize end diff --git a/app/models/communication/block/template/page.rb b/app/models/communication/block/template/page.rb index 16a94047e21a97236e786471b88ee056d9ea9277..2d3285619a0be1f55b704617428664e9db20f22c 100644 --- a/app/models/communication/block/template/page.rb +++ b/app/models/communication/block/template/page.rb @@ -29,6 +29,11 @@ class Communication::Block::Template::Page < Communication::Block::Template::Bas selected_pages end + def heading_title + block.title.present? ? block.title + : page&.title + end + protected def selected_pages_selection diff --git a/app/models/communication/block/with_heading_ranks.rb b/app/models/communication/block/with_heading_ranks.rb index 33ea91848646e8586cc9844c8c6e1f48253409a4..da97b391993c54bb08715fa05f82629213c514ad 100644 --- a/app/models/communication/block/with_heading_ranks.rb +++ b/app/models/communication/block/with_heading_ranks.rb @@ -4,8 +4,8 @@ module Communication::Block::WithHeadingRanks DEFAULT_HEADING_LEVEL = 2 # h1 is the page title def heading_rank_self - title.present? ? heading_rank_base - : false + template.heading_title.present? ? heading_rank_base + : false end def heading_rank_children diff --git a/app/views/admin/communication/blocks/_static.html.erb b/app/views/admin/communication/blocks/_static.html.erb index e0c2d9d88fc1a918d2930b10b5526fbd0433c648..65a4e0bdee420bf87f1eae416e05d48f57e1149d 100644 --- a/app/views/admin/communication/blocks/_static.html.erb +++ b/app/views/admin/communication/blocks/_static.html.erb @@ -5,7 +5,7 @@ should_render_data = block.data && block.data.present? - kind: block template: <%= block.template_kind %> title: >- - <%= prepare_text_for_static block.title %> + <%= prepare_text_for_static block.template.heading_title %> position: <%= block.position %> ranks: self: <%= block.heading_rank_self %>