Adding groups to this branch, also tidying up the shop stuff for Laura

This commit is contained in:
Will Marshall
2014-05-16 14:00:33 +10:00
parent 3e22e55b61
commit eab9c28d2e
11 changed files with 51 additions and 17 deletions

View File

@@ -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/

View File

@@ -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/

View File

@@ -0,0 +1,5 @@
class GroupsController < ApplicationController
def index
@groups = EnterpriseGroup.on_front_page.by_position
end
end

View File

@@ -0,0 +1,2 @@
module GroupsHelper
end

View File

View File

@@ -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"}

View File

@@ -2,11 +2,9 @@
%span.bulk{"bo-if" => "product.group_buy"} bulk
&nbsp;
.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 }}

View File

@@ -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 }}

View File

@@ -1,12 +1,12 @@
.row{bindonce: true,
"ng-repeat" => "variant in product.variants"}
.small-1.column
%span.bulk{"bo-if" => "product.group_buy"} bulk
&nbsp;
.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 }}

View File

@@ -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

View File

@@ -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