29 lines
549 B
CoffeeScript
29 lines
549 B
CoffeeScript
|
|
|
|
$ = jQuery
|
|
context = window
|
|
context.JK ||= {};
|
|
|
|
class JamTrackUtils
|
|
constructor: () ->
|
|
@logger = context.JK.logger
|
|
@rest = new context.JK.Rest();
|
|
|
|
init: () =>
|
|
|
|
# check if the shopping cart should be shown
|
|
checkShoppingCart: () =>
|
|
@rest.getShoppingCarts().done(this.displayCartIcon)
|
|
|
|
displayCartIcon: (carts) =>
|
|
cartLink = $("#header-shopping-cart")
|
|
if carts.length > 0
|
|
cartLink.removeClass("hidden")
|
|
else
|
|
cartLink.addClass("hidden")
|
|
|
|
|
|
|
|
|
|
# global instance
|
|
context.JK.JamTrackUtils = new JamTrackUtils() |