Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/models/communication/block/template/contact/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ class Communication::Block::Template::Contact::Element < Communication::Block::T
has_component :title, :string
has_component :time_slot_morning, :time_slot
has_component :time_slot_afternoon, :time_slot

def empty?
title.blank? &&
time_slot_morning['from'].blank? &&
time_slot_afternoon['from'].blank?
end
end
3 changes: 3 additions & 0 deletions app/models/communication/block/template/gallery/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ def check_accessibility
accessibility_warning 'accessibility.commons.alt.empty' if image_component.blob && alt.blank?
end

def empty?
blob.blank?
end
end
3 changes: 3 additions & 0 deletions app/models/communication/block/template/link/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ def url_external?(website)
!url.start_with?(website.url)
end

def empty?
title.blank? && description.blank? && url.blank?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ class Communication::Block::Template::Testimonial::Element < Communication::Bloc
has_component :job, :string
has_component :photo, :image

def empty?
text.blank?
end
end
3 changes: 3 additions & 0 deletions app/models/communication/block/template/timeline/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ class Communication::Block::Template::Timeline::Element < Communication::Block::
has_component :title, :string
has_component :text, :rich_text

def empty?
title.blank? && text.blank?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
buttons:
<%
block.template.elements.each do |element|
next if element.title.blank?
%>
next if element.title.blank? %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :url, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<%= block_component_static block, :information %>
<%= render 'admin/application/contact_details/static', about: block.template, l10n: block.template, depth: 3 %>
timetable:
<% block.template.elements.each do |element| %>
<%
block.template.elements.each do |element|
next if element.empty? %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :time_slot_morning, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
elements:
<%
block.template.elements.each do |element|
next if element.empty?
%>
next if element.empty? %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
images:
<%
block.template.elements.each do |element|
next unless element.blob %>
next if element.empty? %>
-
<%= block_component_static block, :image, template: element, depth: 5 %>
<%= block_component_static block, :alt, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%= block_component_static block, :description %>
figures:
<% block.template.elements.each do |element| %>
<%
block.template.elements.each do |element|
next if element.empty? %>
- <%= block_component_static block, :number, template: element, depth: 0 %>
<%= block_component_static block, :unit, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
layout: <%= block.template.layout %>
<%= block_options_static block %>
links:
<% block.template.elements.each do |element| %>
<%
block.template.elements.each do |element|
next if element.empty? %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%= block_component_static block, :layout %>
testimonials:
<% block.template.elements.each do |element| %>
<%
block.template.elements.each do |element|
next if element.empty? %>
-
<%= block_component_static block, :text, template: element, depth: 5 %>
<%= block_component_static block, :author, template: element, depth: 5 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%= block_component_static block, :layout %>
events:
<% block.template.elements.each do |element| %>
<%
block.template.elements.each do |element|
next if element.empty? %>
-
<%= block_component_static block, :title, template: element, depth: 5 %>
<%= block_component_static block, :text, template: element, depth: 5 %>
Expand Down
Loading