From a3dfe1b1478fb6ca2ee4c92f769f6126c37425b4 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Wed, 18 Dec 2013 12:26:34 +1100 Subject: [PATCH] Working on the HTML structure, variants etc --- app/assets/stylesheets/darkswarm/shop.css.sass | 11 ++++++++--- .../stylesheets/darkswarm/typography.css.sass | 18 ++++++++++-------- app/serializers/enterprise_serializer.rb | 3 +++ app/serializers/spree/product_serializer.rb | 1 + app/views/shop/_order_cycles.html.haml | 2 +- app/views/shop/_products.html.haml | 15 +++++++++------ spec/features/consumer/shopping_spec.rb | 4 ++++ 7 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 app/serializers/enterprise_serializer.rb diff --git a/app/assets/stylesheets/darkswarm/shop.css.sass b/app/assets/stylesheets/darkswarm/shop.css.sass index 7637ff28c6..9b7485547d 100644 --- a/app/assets/stylesheets/darkswarm/shop.css.sass +++ b/app/assets/stylesheets/darkswarm/shop.css.sass @@ -38,7 +38,6 @@ shop width: 200px display: inline-block background: transparent - font-weight: bold border-color: #888 products @@ -46,14 +45,20 @@ shop padding-top: 36px table width: 100% - font-size: 1.2em border-collapse: collapse border: none + th + line-height: 50px td, th background: #fff - border: 1px solid #bbb + border: 1px solid #cccccc border-left: 0px border-right: 0px + td + padding: 20px 0px + input[type=number] + width: 60px + margin: 0px diff --git a/app/assets/stylesheets/darkswarm/typography.css.sass b/app/assets/stylesheets/darkswarm/typography.css.sass index 46a430aef1..93e3813d93 100644 --- a/app/assets/stylesheets/darkswarm/typography.css.sass +++ b/app/assets/stylesheets/darkswarm/typography.css.sass @@ -14,18 +14,20 @@ font-family: 'AvenirMed' src: url("/AvenirLTStd-Medium.otf") format("opentype") -body - font-family: "AvenirMed_IE", "AvenirMed" +//body + //font-family: "AvenirBla_IE", "AvenirBla" h1, h2, h3, h4, h5, h6 - color: #666 - font-family: "AvenirMed_IE", "AvenirMed" + color: #333333 + font-family: "AvenirBla_IE", "AvenirBla" + padding: 0px + +td + font-family: "helvetica" // These selectors match the default Foundation selectors // For clean overriden magic table tr th, table tr td - color: #666 -table tr th, - font-weight: bold + color: #333333 table thead tr th, table thead tr td, table tfoot tr th, table tfoot tr td - color: #444 + color: #333333 diff --git a/app/serializers/enterprise_serializer.rb b/app/serializers/enterprise_serializer.rb new file mode 100644 index 0000000000..5b6be8ecbe --- /dev/null +++ b/app/serializers/enterprise_serializer.rb @@ -0,0 +1,3 @@ +class EnterpriseSerializer < ActiveModel::Serializer + attributes :id, :name, :description +end diff --git a/app/serializers/spree/product_serializer.rb b/app/serializers/spree/product_serializer.rb index f152c6915a..86bb92afcc 100644 --- a/app/serializers/spree/product_serializer.rb +++ b/app/serializers/spree/product_serializer.rb @@ -2,6 +2,7 @@ module Spree class ProductSerializer < ActiveModel::Serializer attributes :id, :name, :description, :price has_one :master + has_one :supplier has_many :variants end end diff --git a/app/views/shop/_order_cycles.html.haml b/app/views/shop/_order_cycles.html.haml index 691e653cc0..993b57477e 100644 --- a/app/views/shop/_order_cycles.html.haml +++ b/app/views/shop/_order_cycles.html.haml @@ -12,7 +12,7 @@ %form.custom %strong Ready for: %select#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id", - "ng-init" => "order_cycle.order_cycle_id = #{current_order_cycle.andand.id}", + "ng-init" => "order_cycle.order_cycle_id = #{current_order_cycle.andand.id || nil}", "ng-change" => "changeOrderCycle()", "ng-options" => "oc.id as oc.time for oc in #{@order_cycles.map {|oc| {time: pickup_time(oc), id: oc.id}}.to_json}"} diff --git a/app/views/shop/_products.html.haml b/app/views/shop/_products.html.haml index 130ed31130..9d73e4772c 100644 --- a/app/views/shop/_products.html.haml +++ b/app/views/shop/_products.html.haml @@ -1,9 +1,10 @@ %products{"ng-controller" => "ProductsCtrl"} %form.custom + %input.button.right{type: :submit, value: "Check Out"} %table %thead %th{colspan: 2} Item - %th Description + %th Notes %th Variant %th QTY %th Bulk @@ -11,10 +12,12 @@ %tbody{"ng-repeat" => "product in data.products "} %tr.product %td - {{ product.master.images[0].mini_url }} - {{product.master.images[0].alt}} + -#{{ product.master.images[0].mini_url }} + -#{{product.master.images[0].alt}} %td - {{ product.name }} + %h5 + {{ product.name }} + {{ product.supplier.name }} %td {{ product.description }} %td {{ product.master.options_text }} %td @@ -39,6 +42,6 @@ Not available %td.price %small from - $ {{ variant.price }} - + ${{ variant.price }} + %input.button.right{type: :submit, value: "Check Out"} %pre {{ data.products | json }} diff --git a/spec/features/consumer/shopping_spec.rb b/spec/features/consumer/shopping_spec.rb index 508856d761..8e0541fca7 100644 --- a/spec/features/consumer/shopping_spec.rb +++ b/spec/features/consumer/shopping_spec.rb @@ -67,6 +67,10 @@ feature "As a consumer I want to shop with a distributor", js: true do select "frogs", :from => "order_cycle_id" page.should have_content product.name end + + it "shows variants when an order cycle has been selected" do + #create(:variant, : + end end end