noesya/osuny

View on GitHub
app/views/admin/communication/blocks/templates/contact/_static.html.erb

Summary

Maintainability
Test Coverage
<%= block_component_static block, :description %>
<%= block_component_static block, :name %>
<%= block_component_static block, :information %>
      address:
<%= block_component_static block, :address, depth: 4 %>
<%= block_component_static block, :zipcode, depth: 4 %>
<%= block_component_static block, :city, depth: 4 %>
<%= block_component_static block, :country, depth: 4 %>
      contact_details:
<%= render 'admin/application/static/postal_address', about: block.template, depth: 4 %>
<%
if block.template.url.present?
  detail = ContactDetails::Website.new block.template.url
  %>
        url:
          label: >-
            <%= detail.label %>
          value: >-
            <%= detail.value %>
<% end %>
<% if block.template.phone_numbers.any? %>
        phone_numbers:
<% 
block.template.phone_numbers.each do |phone|
  detail = ContactDetails::Phone.new phone
  %>
          - label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% end %>
<% if block.template.emails.any? %>
        emails:
<% 
block.template.emails.each do |email|
  detail = ContactDetails::Email.new email
  %>
          - label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% end %>
        social_networks:
<% 
if block.template.social_facebook.present?
  detail = ContactDetails::Facebook.new block.template.social_facebook
  %>
          facebook:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_github.present?
  detail = ContactDetails::Github.new block.template.social_github
  %>
          github:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_instagram.present?
  detail = ContactDetails::Instagram.new block.template.social_instagram
  %>
          instagram:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_linkedin.present?
  detail = ContactDetails::Linkedin.new block.template.social_linkedin
  %>
          linkedin:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_mastodon.present?
  detail = ContactDetails::Mastodon.new block.template.social_mastodon
  %>
          mastodon:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_peertube.present?
  detail = ContactDetails::Peertube.new block.template.social_peertube
  %>
          peertube:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_tiktok.present?
  detail = ContactDetails::Tiktok.new block.template.social_tiktok
  %>
          tiktok:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_vimeo.present?
  detail = ContactDetails::Vimeo.new block.template.social_vimeo
  %>
          vimeo:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_x.present?
  detail = ContactDetails::X.new block.template.social_x
  %>
          x:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% 
if block.template.social_youtube.present?
  detail = ContactDetails::Youtube.new block.template.social_youtube
  %>
          youtube:
            label: >-
              <%= detail.label %>
            value: >-
              <%= detail.value %>
<% end %>
<% # deprecated %>
<%= block_component_static block, :phone_numbers %>
<%= block_component_static block, :url %>
<%= block_component_static block, :emails %>
      socials:
<% 
[
  :social_mastodon, 
  :social_x, 
  :social_linkedin, 
  :social_youtube, 
  :social_vimeo, 
  :social_peertube, 
  :social_instagram, 
  :social_facebook, 
  :social_tiktok, 
  :social_github,
].each do |network| 
  value = block.template.public_send network
  next if value.blank?
%>
        <%= network.to_s.remove('social_') %>: >-
          <%= prepare_text_for_static value %>
<% end %>
<% #/ deprecated %>
      timetable:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, list: true, depth: 4 %>
<%= block_component_static block, :time_slot_morning, template: element, depth: 5 %>
<%= block_component_static block, :time_slot_afternoon, template: element, depth: 5 %>
<% end %>