team-umlaut/umlaut

View on GitHub
app/views/resolve/_service_errors.html.erb

Summary

Maintainability
Test Coverage
<% 
failed_dispatches = failed_service_dispatches()
unless ( failed_dispatches.nil? || failed_dispatches.empty? ) %>
  <div id="service_errors_content" class="alert alert-danger">
    <h5 class="warning"><i class="umlaut_icons-famfamfam-error"></i> <%= t 'umlaut.error.service_errors_title' %></h5>
    <ul class="list-unstyled">
      <% failed_dispatches.each do | dispatch | %>
        <li class="text-small">
          <%= t 'umlaut.error.services_missing' %><strong> <%= dispatch.service.service_types_generated.collect { |type|
            type.display_name_pluralize}.uniq.join(", ")%></strong>
          <%= t 'umlaut.resolve.from_service' %> <a class="collapse-toggle alert-link" data-target="<%= "#failed_dispatch_#{dispatch.id}"%>" data-toggle="collapse"><strong><%= dispatch.service.display_name %></strong></a>
          <% exception_info = dispatch.exception_info %>
          <div id="<%= "failed_dispatch_#{dispatch.id}"%>" class="collapse">
            <ul class="nav nav-list">
              <li class="nav-header"><%= t 'umlaut.error.technical_error_info' %></li>
              <%= content_tag("li") do
                content_tag("pre", :class=>"pre-scrollable") do
                  error_message = (exception_info) ? "#{exception_info[:class_name]}: #{exception_info[:message]}\n" : ""
                  error_message + "dispatched service id: #{dispatch.id}"
                end
              end %>
            </ul>
          </div>
        </li>
      <% end %>
    </ul>
  </div>
<% end %>