noesya/osuny

View on GitHub
app/views/admin/application/categories/_static.html.erb

Summary

Maintainability
Test Coverage
<%
about_categories = about.categories
taxonomies = categories.taxonomies.ordered
%>
<% if about_categories.any? %>
<%= key %>:
<%
about_categories.ordered.each do |category|
  category_l10n = category.localization_for(l10n.language)
  next if category_l10n.nil?
%>
  - "<%= category_l10n.slug_with_ancestors_slugs(separator: '-') %>"
<% end %>
<%
  if taxonomies.any?
%>
taxonomies:
<%
    taxonomies.each do |taxonomy|
      taxonomy_l10n = taxonomy.localization_for(l10n.language)
      next if taxonomy_l10n.nil?
%>
  - name: "<%= prepare_text_for_static taxonomy_l10n.to_s %>"
    slug: "<%= taxonomy_l10n.slug_with_ancestors_slugs(separator: '-') %>"
    categories:
<%
      about_categories.in_taxonomy(taxonomy).each do |category|
        category_l10n = category.localization_for(l10n.language)
        next if category_l10n.nil?
        hugo = category_l10n.hugo(@website)
%>
      - name: "<%= prepare_text_for_static category_l10n.to_s %>"
        permalink: "<%= hugo.permalink %>"
        file: "<%= hugo.file %>"
        path: "<%= hugo.path %>"
        slug: "<%= hugo.slug %>"
<%
      end
    end
  end
end
%>