This commit is contained in:
Steve Pettitt
2016-01-10 07:58:04 +00:00
parent 81b688f0e8
commit 262a8e75f9
3 changed files with 9 additions and 4 deletions

View File

@@ -1,9 +1,9 @@
Darkswarm.controller "DistributorNodeCtrl", ($scope, HashNavigation, $anchorScroll) ->
$scope.toggle = ->
HashNavigation.toggle $scope.distributor.id
HashNavigation.toggle $scope.distributor.hash
$scope.open = ->
HashNavigation.active($scope.distributor.id)
HashNavigation.active($scope.distributor.hash)
if $scope.open()
$anchorScroll()

View File

@@ -1,8 +1,13 @@
class Api::OrdersByDistributorSerializer < ActiveModel::Serializer
attributes :name, :id, :balance, :distributed_orders
attributes :name, :id, :hash, :balance, :distributed_orders
has_many :distributed_orders, serializer: Api::OrderSerializer
def balance
object.distributed_orders.map(&:outstanding_balance).reduce(:+).to_money.to_s
end
def hash
object.to_param
end
end

View File

@@ -18,7 +18,7 @@
%distributor.active_table_node.row.animate-repeat{"ng-repeat" => "(key, distributor) in Orders.orders_by_distributor",
"ng-controller" => "DistributorNodeCtrl",
"ng-class" => "{'closed' : !open(), 'open' : open(), 'inactive' : !distributor.active}",
id: "{{distributor.id}}"}
id: "{{distributor.hash}}"}
.small-12.columns
= render partial: "spree/users/skinny"
= render partial: "spree/users/fat"