noesya/osuny

View on GitHub
app/views/admin/education/programs/_static_list.html.erb

Summary

Maintainability
Test Coverage
<%
depth ||= 2
indentation = ' ' * depth
%>
<% programs.ordered_by_name(language).each do |program| %>
  <%
  program_l10n = program.localization_for(language)
  next unless program_l10n
  %>
<%= indentation %>- label: >-
<%= indentation %>    <%= program_l10n.to_s %>
<%= indentation %>  path: "<%= program_l10n.current_permalink_in_website(@website)&.path %>"
<%= indentation %>  slug: "/<%= program_l10n.slug_with_ancestors_slugs %>/"
<%
children = program.children.published_now_in(language).where(diploma: diploma)
# Limit to a global list of programs, for example on a location
children = children.where(id: all_programs) if local_assigns[:all_programs]
%>
<% if children.any? %>
<%= indentation %>  children:
<%= render 'admin/education/programs/static_list', diploma: diploma, programs: children, depth: depth + 4, language: language %>
<% end %>
<% end %>