roseweixel/lacquer-lover

View on GitHub
app/views/brands/show.html.erb

Summary

Maintainability
Test Coverage
<div class="row">
<h1 class="col-sm-6 pull-left"><%= @brand.name %></h1>

<% if @brand.lacquers.any? %>
  <% if current_user %>
  <%= form_for @brand, remote: true do |f| %>
    <%= fields_for "user_lacquers[]", @brand do |ul_form| %>
      <div class="row">
        <%= ul_form.submit "Add to My Collection", class: "col-md-2 pull-right btn btn-default add-to-btn", style: "margin-top: 25px;" %>
      </div>  
      <% @brand.lacquers.each do |lacquer| %>
        <div class="col-md-3 lacquer" id="<%=lacquer.id%>">
        </div>
      <% end %>
    <% end %>
  <% end %>
  <% else %>
    <div class="row">
      <div class="col-sm-5 pull-right">
      <%= link_to "Sign In To Favorite & Add Lacquers to Your Collection!", "/auth/facebook", class: "pull-right btn btn-primary sign-in-to-btn", id: "brand-show-sign-in", style: "margin-top: 25px;" %>
      </div>
    </div>  
    <div class="row-fluid">
    <% @brand.lacquers.each do |lacquer| %>
      <div class="col-md-3 lacquer long-item-card" id="<%=lacquer.id%>">
      </div>
    <% end %>
    </div>
  <% end %>
<% else %>

  <br>
  <br>
  <br>

  <h3 class="col-lg-12">No lacquers added yet for this brand. If you own <%= @brand.name %> lacquers, add them to your collection from your profile page!</h3>

<% end %>
</div>