brokenfingers/Fabric_Manager

View on GitHub
app/views/user/show.html.haml

Summary

Maintainability
Test Coverage
%body.user_show
  = render 'shared/top_menu_bar'

  = render 'shared/side_menu_bar'

  %div
    %table#fabrics.table.table-hover
      %thead
        %tr
          %th Color
          %th Serial
          %th Quantity
          %th Price/m
          %th Meters Sold
          %th Rolls Sold
          %th Profit
          %th Actions
      %tbody#fabric_table
        - if @fabrics.any?
          - @fabrics.each do |fabric|
            %tr{:id => fabric.id}
              %td= fabric.color 
              %td= fabric.serial
              %td= fabric.quantity
              %td= fabric.price
              %td= fabric.meters_sold
              %td= fabric.rolls_sold
              %td= fabric.total_profit
              %td= link_to "Remove", user_fabric_path(@user, fabric), :method => "delete", :remote => true

    %p#create_button Add new Item to Inventory
    %div#fabric_creation_form
      = simple_form_for :fabric, remote: true, :url => user_fabric_index_path(@user) do |f|
        = f.input :color, :as => :string
        = f.input :serial, :as => :string
        = f.input :quantity, :as => :integer
        = f.input :price, :as => :decimal
        = f.submit "Add Fabric", id: "add_fabric_btn"