diff --git a/app/models/communication/block/template/base/with_top.rb b/app/models/communication/block/template/base/with_top.rb index f4cdeed0da00e279594225d1ad204f762a1f85ec..674a65c8436351af6eaab89c87af26cd3c7f6465 100644 --- a/app/models/communication/block/template/base/with_top.rb +++ b/app/models/communication/block/template/base/with_top.rb @@ -1,19 +1,27 @@ module Communication::Block::Template::Base::WithTop extend ActiveSupport::Concern + def top_active + top_title.present? || top_description.present? + end + def top_title block.try(:title) end - def top_description - try(:description) + def top_heading + block.heading_rank_base end def top_link nil end - def top_heading - block.heading_rank_base + def top_screen_reader_only + false + end + + def top_description + try(:description) end end diff --git a/app/models/communication/block/template/testimonial.rb b/app/models/communication/block/template/testimonial.rb index 89a595b7a2cab8133c0187dac5e9f00daa0058d1..fca3969cb85113a775fe79d549a3cbd06848c9f7 100644 --- a/app/models/communication/block/template/testimonial.rb +++ b/app/models/communication/block/template/testimonial.rb @@ -2,4 +2,7 @@ class Communication::Block::Template::Testimonial < Communication::Block::Templa has_elements + def top_screen_reader_only + true + end end diff --git a/app/views/admin/communication/blocks/_static.html.erb b/app/views/admin/communication/blocks/_static.html.erb index 4a980491341cf09f71772b980763f6dd0e8a68c6..b3d62c818e5d583152aac8257f58b4191503f959 100644 --- a/app/views/admin/communication/blocks/_static.html.erb +++ b/app/views/admin/communication/blocks/_static.html.erb @@ -20,6 +20,7 @@ should_render_data = block.data && block.data.present? html_class: "<%= block.html_class_prepared %>" <% end %> top: + active: <%= block.template.top_active %> <% if block.template.top_title.present? %> title: value: >- @@ -28,6 +29,9 @@ should_render_data = block.data && block.data.present? <% if block.template.top_link.present? %> link: "<%= block.template.top_link %>" <% end %> +<% if block.template.top_screen_reader_only.present? %> + screen_reader_only: <%= block.template.top_screen_reader_only %> +<% end %> <% end %> <% if block.template.top_description.present? %> description: >-