noesya/osuny

View on GitHub
app/views/admin/education/schools/static.html.erb

Summary

Maintainability
Test Coverage
<%
school = @l10n.about
language = @l10n.language
administrator_involvements = school.involvements_through_roles.includes(:person).ordered_by_name(language)
%>---
name: "<%= prepare_text_for_static @l10n.name %>"
address: >-
  <%= prepare_text_for_static school.address %>
zipcode: "<%= prepare_text_for_static school.zipcode %>"
city: "<%= prepare_text_for_static school.city %>"
country: "<%= prepare_text_for_static school.country_common_name %>"
phone: "<%= prepare_text_for_static school.phone %>"
url: "<%= prepare_text_for_static @l10n.url %>"
contact_details:
<%= render 'admin/application/static/postal_address', about: school, l10n: @l10n, language: language %>
<%
if @l10n.url.present?
  detail = ContactDetails::Website.new @l10n.url
  %>
  url:
    label: >-
      <%= detail.label %>
    value: >-
      <%= detail.value %>
<% end %>
<%
if school.phone.present?
  detail = ContactDetails::Phone.new school.phone
  %>
  phone:
    label: >-
      <%= detail.label %>
    value: >-
      <%= detail.value %>
<% end %>
<% if @l10n.logo.attached? %>
logo:
  id: "<%= @l10n.logo.blob.id %>"
<% end %>
<% if administrator_involvements.any? %>
administrators:
<%
administrator_involvements.each do |involvement|
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  - "<%= person_l10n.slug %>"
<% end %>
administrators_description:
<%
administrator_involvements.each do |involvement|
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  "<%= person_l10n.slug %>": >-
    <%= involvement.target.to_s_in(language) %>
<% end %>
roles:
<% school.university_roles.ordered.each do |role| %>
  - title: >-
      <%= prepare_text_for_static role.to_s_in(language) %>
    persons:
    <%
    role.involvements.includes(:person).ordered.each do |involvement|
      person_l10n = involvement.person.localization_for(language)
      next if person_l10n.nil?
    %>
      - "<%= person_l10n.slug %>"
    <% end %>
<% end %>
<% else %>
roles: []
<% end %>
---