BathHacked/energy-sparks

View on GitHub
app/components/alerts_component/alerts_component.html.erb

Summary

Maintainability
Test Coverage
<div class="alerts-component">
  <% alerts.each do |alert_content|%>
    <%= component 'notice', classes: 'mt-4', status: status_for_alert_colour(alert_content.colour) do |c| %>
      <div class="row">
        <% if show_icons %>
          <div class="col-md-1 d-flex align-items-center">
            <%= fa_icon( alert_icon(alert_content.alert, 'fa-3x') ) %>
          </div>
        <% end %>
        <div class="<%= show_icons ? "col-md-11" : "col-md-12" %>">
          <%= alert_content.send(content_field) %>
          <% if show_links && alert_content.alert.advice_page.present? %>
            <div class="text-right">
              <%= link_to t('advice_pages.index.alerts.view_analysis'), advice_page_path(school, alert_content.alert.advice_page, alert_content.alert.alert_type.advice_page_tab_for_link_to, anchor: alert_content.alert.alert_type.link_to_section) %>
            </div>
          <% end %>
        </div>
      </div>
    <% end %>
  <% end %>
</div>