noesya/osuny

View on GitHub
app/views/admin/communication/websites/pages/show/_metadata.html.erb

Summary

Maintainability
Test Coverage
<%= osuny_panel t('metadata'), small: true do %>
  <p>
    <%
    # On veut mentionner la page spéciale, mais pas si elle porte le même nom que la page, ça ferait un doublon
    if @page.is_special_page?
      special_page_title_key = "communication.website.pages.defaults.#{@page.type_key}.title"
      special_page_default_title = t(special_page_title_key, locale: @l10n.language.iso_code)
      default_title_was_changed = special_page_default_title != @page.to_s
      %>
      <% if default_title_was_changed %>
        <%= special_page_default_title %><br>
      <% end %>
    <% end %>

    <%= @l10n.published ? t('admin.communication.website.page.localizations.published')
                        : t('admin.communication.website.page.localizations.draft') %>

    <%= t('admin.communication.website.pages.in_full_width') if @page.full_width %>

    <% if @page.parent && !@page.parent.is_home? %>
      <%= t('admin.communication.website.pages.in') %>
      “<%= osuny_link_localized_if  can?(:read, @page.parent),
                                    @page.parent,
                                    admin_communication_website_page_path(
                                      website_id: @website.id,
                                      id: @page.parent.id
                                    ) %>”
    <% end %>

    <% if @page.children.any? %>
      <%= t('admin.communication.website.pages.with_children') %>
      <%= raw @page.children.ordered.map { |child|
            osuny_link_localized_if   can?(:read, child),
                                      child,
                                      admin_communication_website_page_path( website_id: @website.id, id: child.id),
                                      classes: "#{'draft' unless child.published_in?(current_language)}"
      }.join(', ') %>
    <% end %>
  </p>
  <%= render 'admin/application/permalinks/redirects', about: @l10n %>
<% end %>
<%= render 'admin/application/l10n/widget', about: @page, l10n: @l10n, small: true %>