app/views/brands/index.html.erb
<div class="row">
<h1 class="col-sm-5" style="display: inline;">All the Brands</h1>
<h2 style="display: inline; text-align: right;" class="col-sm-7">(<span id='all-lacquers-count'><%= Lacquer.count %></span> lacquers and counting!)</h2>
</div>
<ul class="list-group">
<% @brands.order(:name).each do |brand| %>
<li class="row list-group-item long-item-card" id="<%= brand.id %>">
<div class="col-xs-6">
<span class="no-underline" style="padding: 5px;">
<strong><%= link_to brand.name, brand_path(brand) %></strong>
</span><br>
<span class="item-brand" style="margin-right:0;"><%= pluralize(brand.lacquers.count, "lacquer") %></span>
<span class="item-brand" style="margin-left:-4px;">
<% if brand.favorites.any? %>
<a class="no-underline toggle toggle-favorites"><%= pluralize(brand.favorites.count, "favorite") %></a>
<% else %>
<span><%= pluralize(brand.favorites.count, "favorite") %></span>
<% end %>
</span>
<span class="item-brand-last">
<% if current_user && brand.users.any? %>
<a class="no-underline toggle toggle-users"><%= pluralize(brand.users.count, "lacquer lover") %></a>
<% else %>
<span><%= pluralize(brand.users.count, "lacquer lover") %></span>
<% end %>
</span>
</div>
<% if current_user %>
<div class="col-xs-6 slide-right brand-lacquer-lovers" style="display: none;">
<ul class="row" style="display: inline-block; width: 100%;">
<% brand.users.each do |user| %>
<li class="col-sm-4" style="list-style-type: none;">
<%= link_to user.name, user_path(user) %><br>(<strong><%= user.lacquers.where(brand_id: brand.id).count %></strong> <%= 'lacquer'.pluralize(user.lacquers.where(brand_id: brand.id).count) %>)
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="col-xs-6 slide-right brand-favorites" style="display: none;">
<ul class="row">
<% Lacquer.find(brand.favorites.pluck(:lacquer_id)).each do |lacquer| %>
<li class="col-sm-4" style="list-style-type: none;">
<%= link_to lacquer.name, lacquer_path(lacquer) %><br>(<strong><%= lacquer.favorites.count %></strong> <%= 'favorite'.pluralize(lacquer.favorites.count) %>)
</li>
<% end %>
</ul>
</div>
</li>
<% end %>
</ul>