From 1c7e73c7055e082158f89d40e2beca2a4a711fe9 Mon Sep 17 00:00:00 2001 From: Febri Date: Tue, 5 Jun 2012 00:55:30 +0700 Subject: [PATCH 1/2] Add function to decide whether use "items" or "item" --- javascripts/json_store.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/javascripts/json_store.js b/javascripts/json_store.js index e07a756..72279a1 100644 --- a/javascripts/json_store.js +++ b/javascripts/json_store.js @@ -49,8 +49,15 @@ $.each(this.session('cart') || {}, function(id, quantity) { sum += quantity; }); + + // function to decide whether use "items" or "item" + var plural = function(num) { + return ( num > 1 ) ? 'items' : 'item'; + }; + $('.cart-info') .find('.cart-items').text(sum).end() + .find('.cart-plural').text( plural(sum) ).end() .animate({paddingTop: '30px'}) .animate({paddingTop: '10px'}); }); From 68959c844453be32c9ab879854d4c3acd71cb320 Mon Sep 17 00:00:00 2001 From: Febri Date: Tue, 5 Jun 2012 00:56:40 +0700 Subject: [PATCH 2/2] Update master --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ba64788..7512537 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@