Files
openfoodnetwork/app/assets/javascripts/darkswarm/shop.js.coffee
2013-12-18 14:45:32 +11:00

14 lines
527 B
CoffeeScript

window.Shop = angular.module("Shop", ["ngResource", "filters"]).config ($httpProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
#angular.module('Shop', ['filters'])
angular.module("filters", []).filter "truncate", ->
(text, length, end) ->
length = 10 if isNaN(length)
end = "..." if end is `undefined`
if text.length <= length or text.length - end.length <= length
text
else
String(text).substring(0, length - end.length) + end