noesya/osuny

View on GitHub
app/views/admin/application/a11y/_widget.html.erb

Summary

Maintainability
Test Coverage
<%
horizontal ||= false
color = about.accessible? ? 'text-success' : 'text-danger'
action = "<i class=\"#{ Icon::A11Y } h4 float-end #{ color}\"></i>"
%>
<%= osuny_panel t('accessibility.label'), small: true do %>
  <% if horizontal %>
    <div class="row"><div class="offset-lg-4 col-lg-8 mt-lg-n4">
  <% end %>
  <% if about.accessibility_errors_grouped.any? %>
    <p class="text-danger">
      <i class="<%= Icon::A11Y %>"></i>
      <%= t('accessibility.errors', count: about.accessibility_errors.count) %>
    </p>
    <ol class="list-unstyled">
      <% about.accessibility_errors_grouped.each do |key, quantity| %>
        <li>
          <%
          label =  t("#{key}.title")
          label += " (× #{quantity})" if quantity > 1
          %>
          <%= osuny_label label, classes: 'text-danger' %>
          <p><%= t "#{key}.text_html" %></p>
        </li>
      <% end %>
    </ol>
  <% else %>
    <p>
      <i class="<%= Icon::A11Y %> text-success"></i>
      <%= t 'accessibility.errors', count: 0 %>
    </p>
  <% end %>
  <% if about.accessibility_warnings_grouped.keys.any? %>
    <%= osuny_label t('accessibility.warnings', count: about.accessibility_warnings.count) %>
    <ul class="list-unstyled">
      <% about.accessibility_warnings_grouped.each do |key, quantity| %>
      <li>
        <%
        label =  t("#{key}.title")
        label += " (× #{quantity})" if quantity > 1
        %>
        <%= osuny_label label %>
        <p>
          <%= t "#{key}.text_html" %>
        </p>
      </li>
      <% end %>
    </ul>
  <% end %>
  <% if horizontal %>
    </div></div>
  <% end %>
<% end %>