Merge branch 'master' into currency

This commit is contained in:
Rafael Schouten
2014-09-11 12:09:18 +10:00
60 changed files with 1152 additions and 431 deletions

View File

@@ -24,5 +24,5 @@ angular.module("ofn.admin").factory 'EnterpriseRelationships', ($http, enterpris
permission_presentation: (permission) ->
switch permission
when "add_to_order_cycle" then "can add to order cycle"
when "manage_products" then "can manage the products of"
when "add_to_order_cycle" then "to add to order cycle"
when "manage_products" then "to manage products"

View File

@@ -6,9 +6,9 @@ Darkswarm.controller "CheckoutCtrl", ($scope, storage, Checkout, CurrentUser, Cu
prefix = "order_#{Checkout.order.id}#{CurrentUser?.id}#{CurrentHub.hub.id}"
for field in $scope.fieldsToBind
storage.bind $scope, "Checkout.order.#{field}",
storage.bind $scope, "Checkout.order.#{field}",
storeName: "#{prefix}_#{field}"
storage.bind $scope, "Checkout.ship_address_same_as_billing",
storage.bind $scope, "Checkout.ship_address_same_as_billing",
storeName: "#{prefix}_sameasbilling"
defaultValue: true

View File

@@ -13,7 +13,7 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
Loading.clear()
@errors = response.errors
RailsFlashLoader.loadFlash(response.flash)
# Rails wants our Spree::Address data to be provided with _attributes
preprocess: ->
munged_order = {}
@@ -25,7 +25,7 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
munged_order["ship_address_attributes"] = value
when "payment_method_id"
munged_order["payments_attributes"] = [{payment_method_id: value}]
when "shipping_method_id", "payment_method_id", "email"
when "shipping_method_id", "payment_method_id", "email", "special_instructions"
munged_order[name] = value
else
# Ignore everything else
@@ -58,7 +58,7 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
shippingPrice: ->
@shippingMethod()?.price || 0.0
paymentMethod: ->
PaymentMethods.payment_methods_by_id[@order.payment_method_id]

View File

@@ -2,7 +2,7 @@ Darkswarm.factory 'Hubs', ($filter, Enterprises, visibleFilter) ->
new class Hubs
constructor: ->
@hubs = @order Enterprises.enterprises.filter (hub)->
hub.is_distributor
hub.is_distributor && hub.has_shopfront
@visible = visibleFilter @hubs
order: (hubs)->

View File

@@ -1,16 +1,16 @@
.row.pad-top{bindonce: true, "ng-if" => "enterprise.hubs.length > 0"}
.row.pad-top{bindonce: true, "ng-if" => "enterprise.hubs.length > 0 && enterprise.has_shopfront"}
.cta-container.small-12.columns
%label
Shop for
%strong {{enterprise.name}}
products at:
%a.button.hub{"ng-repeat" => "hub in enterprise.hubs",
%a.cta-hub{"ng-repeat" => "hub in enterprise.hubs",
"bo-href" => "hub.path",
"bo-class" => "{primary: hub.active, secondary: !hub.active}",
"ofn-empties-cart" => "hub"}
%i.ofn-i_033-open-sign{"bo-if" => "hub.active"}
%i.ofn-i_032-closed-sign{"bo-if" => "!hub.active"}
{{hub.name}}
.hub-name {{hub.name}}
.button-address {{ hub.address.city }} , {{hub.address.state_name}}
%i.ofn-i_007-caret-right
/ %i.ofn-i_007-caret-right

View File

@@ -1,8 +1,8 @@
.row.pad-top{bindonce: true}
.row.pad-top{bindonce: true, ng: { if: 'enterprise.has_shopfront' } }
.cta-container.small-12.columns
.row
.small-4.columns
%label{"active-table-hub-link" => "enterprise", change: "Change hub to:", shop: "Shop now at:"}
%label{"active-table-hub-link" => "enterprise", change: "Change shop to:", shop: "Shop now at:"}
.small-8.columns.right
%label.right{"bo-if" => "enterprise.pickup || enterprise.delivery"}
Delivery options:
@@ -14,11 +14,11 @@
Delivery
.row
.columns.small-12
%a.button.hub.expand{"bo-href" => "enterprise.path",
%a.cta-hub{"bo-href" => "enterprise.path",
"ng-class" => "{primary: enterprise.active, secondary: !enterprise.active}",
"ofn-empties-cart" => "enterprise"}
%i.ofn-i_033-open-sign{"bo-if" => "enterprise.active"}
%i.ofn-i_032-closed-sign{"bo-if" => "!enterprise.active"}
{{enterprise.name}}
.hub-name {{enterprise.name}}
.button-address {{ enterprise.address.city }} , {{enterprise.address.state_name}}
%i.ofn-i_007-caret-right
/ %i.ofn-i_007-caret-right