<h1><%= @qualification.name %></h1>

<table>
  <tr>
    <th>Name</th>
    <th>Colour</th>
  </tr>

  <% @subjects.each do |subject| %>
  <tr>
    <td><%= subject.name  %></td>
    <td><%= subject.colour %></td>
  </tr>
  <% end %>
</table>
<%= link_to "Back", qualifications_path %>

<%= link_to "Qualification Viewer", root_path %>

<h1><%= @qualification.name %></h1>

<!-- Displays subjects sorted alphabetically with associated colour as background. Displays "Not applicable", if none. -->
<ul>
  <% if @subjects.empty? %>
    <li>Not applicable</li>
  <% else %>
    <% @subjects.order("name").each do |subject| %>
      <li style="background-color: <%= subject.colour %>;"><%= subject.name  %></li>
    <% end %>
  <% end %>
</ul>

<%= link_to "Back", qualifications_path %>

Sort and colour subjects in show view
Sort and colour subjects in show view
