drhenner/ror_ecommerce

View on GitHub
app/views/shopping/cart_items/index.html.erb

Summary

Maintainability
Test Coverage

<% content_for :head do -%>
  <%= stylesheet_link_tag 'shopping_cart_page.css' %>
<% end %>



<div id='cart-items-wrapper' class='items-wrapper large-9 coloumns last'>
  <% if  @cart_items.blank? && @saved_cart_items.empty? %>
    <h2 style='text-align:center;'> <%= I18n.t(:nothing_in_cart) %></h2>
  <% elsif  @cart_items.blank? %>
    <h2 style='text-align:center;'> <%= I18n.t(:only_items_saved_for_later) %></h2>
    <div class='panel graceful'> <h3 style='text-align:center;color:#333;'> <%= I18n.t(:add_items_saved_for_later) %> </h3> </div>
  <% end %>

  <%= form_for session_cart, url: shopping_cart_item_path(session_cart), html: {class: 'custom'}, :as => :cart do |cart_form| %>

    <% unless @cart_items.blank? %>
      <div id='update-cart-wrapper' class=' large-10 columns'>

          <div id='update_all_cart' class="small-gradientbuttons ">
            <ul class=' seven large-7 '>
              <li>
                <span style='margin-top:3px;' class=" ">Make any changes below?</span>
              </li>
              <li>
                <%= cart_form.submit 'update', :class => 'tiny button alert' %>
              </li>
            </ul>

          </div>

      </div>
      <div  class=' large-2 columns' style='margin-top: 3px;text-align: right;'>
        <%= cart_form.submit 'checkout', {:checkout => 1, :class => 'small button success'} %>
      </div>

      <div class="clear"></div>
    <% end %>
    <div class='large-12 columns'>
      <table width="100%" cellspacing="0" cellpadding="0" border="0" style='border: 0px solid #FFF;'>
        <tbody>
          <% unless @cart_items.blank? %>
          <tr>
              <td>
                  <table width="100%" cellspacing="0" cellpadding="10">
                    <tbody>
                      <tr valign="top" bgcolor="#ebebe7" width="100%" >
                        <td bgcolor="#ebebe7" colspan="2"  >
                            <b>Shopping Cart Items--To Buy Now</b>
                        </td>
                        <td bgcolor="#ebebe7" class="small"><b>Price:</b></td>

                        <td width="8%" bgcolor="#ebebe7" align="middle" class="small "><b>Qty:</b></td>
                      </tr>
                      <% @cart_items.each_with_index do |item, i| %>
                        <%= cart_form.fields_for :shopping_cart_items, item do |cart_items_form| %>
                          <%= render :partial => 'cart_item', :locals => {:cart_items_form => cart_items_form, :item => item, :i => i }%>
                        <% end %>
                      <% end %>
                    </tbody>
                  </table>
              </td>
            </tr>
          <% end %>


          <% unless @saved_cart_items.empty? %>
            <tr style='background-color: #FFF;'>
              <td align="center" colspan="1">

              </td>
            </tr>
            <tr style='background-color: #FFF;'>
              <td>
                <table width="100%" cellspacing="0" cellpadding="10" style='border: 0px solid #FFF;'>
                  <tbody>
                    <tr valign="top" bgcolor="#eeeecc">
                        <td bgcolor="#eeeecc" colspan="2"><a name="savedforlater"><b>Saved Items--To Buy Later</b></a></td>
                        <td bgcolor="#eeeecc" colspan="2" class="small"><b>Price:</b></td>
                    </tr>

                    <%= render :partial => '/shopping/cart_items/saved_items' unless @saved_cart_items.empty? %>

                  </tbody>
                </table>
              </td>
            </tr>

          <% end %>

        </tbody>
      </table>
    </div>
  <% end %>
</div>

<div class='span-6 last'>

  <div id='submit_purchase_cart' class="gradientbuttons redtheme purchase-cart">
    <ul>
      <li><%#= link_to 'Checkout', shopping_orders_path, :class => '' %>

      </li>
    </ul>
  </div>
</div>