mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
slugs
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user