diff --git a/app/assets/javascripts/groups.js.coffee b/app/assets/javascripts/groups.js.coffee new file mode 100644 index 0000000000..761567942f --- /dev/null +++ b/app/assets/javascripts/groups.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/groups.css.scss b/app/assets/stylesheets/groups.css.scss new file mode 100644 index 0000000000..c2a5f9013b --- /dev/null +++ b/app/assets/stylesheets/groups.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the groups controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb new file mode 100644 index 0000000000..1d6932b0d5 --- /dev/null +++ b/app/controllers/groups_controller.rb @@ -0,0 +1,5 @@ +class GroupsController < ApplicationController + def index + @groups = EnterpriseGroup.on_front_page.by_position + end +end diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb new file mode 100644 index 0000000000..c091b2fc82 --- /dev/null +++ b/app/helpers/groups_helper.rb @@ -0,0 +1,2 @@ +module GroupsHelper +end diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index 3a7cea9e63..076857fa89 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -12,7 +12,7 @@ .row .small-12.columns .product_table{bindonce: true} - %product.row{"ng-controller" => "ProductNodeCtrl", + %product{"ng-controller" => "ProductNodeCtrl", "ng-repeat" => "product in data.products | filter:query | orderBy:ordering.order | limitTo: limit track by product.id"} = render partial: "shop/products/summary" @@ -20,7 +20,7 @@ %div{"bo-if" => "hasVariants"} = render partial: "shop/products/variants" - .row{"bo-if" => "!hasVariants"} + .row.variant{"bo-if" => "!hasVariants"} = render partial: "shop/products/master" %input.button.right{type: :submit, value: "Add to Cart"} diff --git a/app/views/shop/products/_master.html.haml b/app/views/shop/products/_master.html.haml index c335103d4e..7398912bda 100644 --- a/app/views/shop/products/_master.html.haml +++ b/app/views/shop/products/_master.html.haml @@ -2,11 +2,9 @@ %span.bulk{"bo-if" => "product.group_buy"} bulk   -.small-5.columns - {{ product.name }} +.small-4.columns ({{ product.master.options_text }}) - -# WITHOUT GROUP BUY .small-5.columns{"bo-if" => "!product.group_buy"} %input{type: :number, @@ -16,7 +14,6 @@ name: "variants[{{product.master.id}}]", id: "variants_{{product.master.id}}", "ng-model" => "product.quantity"} - {{ product.master.options_text }} -# WITH GROUP BUY .small-2.columns{"bo-if" => "product.group_buy"} @@ -27,7 +24,6 @@ name: "variants[{{product.master.id}}]", id: "variants_{{product.master.id}}", "ng-model" => "product.quantity"} - {{ product.master.options_text }} (min) .small-3.columns{"bo-if" => "product.group_buy"} @@ -39,5 +35,5 @@ "ng-model" => "product.max_quantity"} (max) -.small-1.column +.small-2.columns.text-right {{ product.price | currency }} diff --git a/app/views/shop/products/_summary.html.haml b/app/views/shop/products/_summary.html.haml index 50f81093d1..ae0e759df6 100644 --- a/app/views/shop/products/_summary.html.haml +++ b/app/views/shop/products/_summary.html.haml @@ -1,14 +1,17 @@ -.row +.row.summary .small-1.column %img{"bo-src" => "product.master.images[0].small_url"} + + .small-4.columns %img{"bo-src" => "product.primary_taxon.icon", "ng-click" => "ordering.order = 'primary_taxon.name'", name: "{{product.primary_taxon.name}}"} + {{ product.name}} + -#= render partial: "shop/products/modal" .small-5.columns - = render partial: "shop/products/modal" - .small-4.columns {{ product.supplier.name }} - .small-1.columns + + .small-2.columns.text-right %span{"ng-if" => "hasVariants"} from {{ price() | currency }} diff --git a/app/views/shop/products/_variants.html.haml b/app/views/shop/products/_variants.html.haml index c915a55361..01041bd1ca 100644 --- a/app/views/shop/products/_variants.html.haml +++ b/app/views/shop/products/_variants.html.haml @@ -1,12 +1,12 @@ .row{bindonce: true, "ng-repeat" => "variant in product.variants"} + .small-1.column %span.bulk{"bo-if" => "product.group_buy"} bulk   - .small-5.columns + .small-4.columns {{ variant.options_text }} - {{ variant.id }} -# WITHOUT GROUP BUY .small-5.columns{"bo-if" => "!product.group_buy"} @@ -17,7 +17,6 @@ max: "{{variant.on_demand && 9999 || variant.count_on_hand }}", name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}", "bo-model" => "variant.quantity"} - {{ variant.options_text }} -# WITH GROUP BUY .small-2.columns{"bo-if" => "product.group_buy"} @@ -28,7 +27,6 @@ max: "{{variant.on_demand && 9999 || variant.count_on_hand }}", name: "variants[{{variant.id}}]", id: "variants_{{variant.id}}", "bo-model" => "variant.quantity"} - {{ variant.options_text }} (min) .small-3.columns{"bo-if" => "product.group_buy"} @@ -40,5 +38,5 @@ "ng-model" => "variant.max_quantity"} (max) - .small-1.columns + .small-2.columns.text-right {{ variant.price | currency }} diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb new file mode 100644 index 0000000000..4005d82a2a --- /dev/null +++ b/spec/controllers/groups_controller_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe GroupsController do + it "gets all visible groups" do + EnterpriseGroup.stub_chain :on_front_page, :by_position + EnterpriseGroup.should_receive :on_front_page + get :index + end +end diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb new file mode 100644 index 0000000000..08a4335bae --- /dev/null +++ b/spec/helpers/groups_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the GroupsHelper. For example: +# +# describe GroupsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe GroupsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end