diff --git a/README.md b/README.md index e2ee07e..40af844 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,9 @@ Each column is represented by an object, the most basic setup simple specifies w There are also some built in 'views' that will create a special column. For example, an 'increment' view: -`{ view: "increment" , label: false , text: "+" }` will have a link that increments the quantity. You can specify the text of the link with that `text:` attribute. +`{ view: "increment" , label: false , text: "+" }` + +will have a link that increments the quantity. You can specify the text of the link with that `text:` attribute. You can add `view: "currency"` to format the column as currency (see the currency section on more information on currency formatting). diff --git a/simpleCart.js b/simpleCart.js index 0e3e7b6..7daabaf 100644 --- a/simpleCart.js +++ b/simpleCart.js @@ -1296,7 +1296,7 @@ generateSimpleCart = function(space){ if( isObject( val ) && val.el ){ simpleCart.$( selector ).html( ' ' ).append( val ); } else if( !isUndefined( val ) ){ - simpleCart.$( selector ).text( val ); + simpleCart.$( selector ).html( val ); } }, @@ -1558,7 +1558,7 @@ generateSimpleCart = function(space){ } } , html: function( html ){ - return this.text( html ); + return this.html( html ); } , val: function( val ){ return this.attr( _VALUE_ , val ); diff --git a/simpleCart.min.js b/simpleCart.min.js index b9e170d..838494e 100644 --- a/simpleCart.min.js +++ b/simpleCart.min.js @@ -31,9 +31,9 @@ b.extend({currency:function(a){if(k(a)&&!c(u[a]))h.currency=a;else if(r(a))u[a.c D=[{selector:"checkout",event:"click",callback:function(){b.checkout()}},{selector:"empty",event:"click",callback:function(){b.empty()}},{selector:"increment",event:"click",callback:function(){b.find(b.$(this).closest(".itemRow").attr("id").split("_")[1]).increment();b.update()}},{selector:"decrement",event:"click",callback:function(){b.find(b.$(this).closest(".itemRow").attr("id").split("_")[1]).decrement();b.update()}},{selector:"remove",event:"click",callback:function(){b.find(b.$(this).closest(".itemRow").attr("id").split("_")[1]).remove()}}, {selector:"input",event:"change",callback:function(){var a=b.$(this),d=a.parent(),e=d.attr("class").split(" ");b.each(e,function(e){e.match(/item-.+/i)&&(e=e.split("-")[1],b.find(d.closest("itemRow").attr("id").split("_")[1]).set(e,a.val()),b.update())})}},{selector:"shelfItem .item_add",event:"click",callback:function(){var a={};b.$(this).closest("."+o+"_shelfItem").descendants().each(function(d,e){var c=b.$(e);c.attr("class")&&c.attr("class").match(/item_.+/)&&!c.attr("class").match(/item_add/)&& b.each(c.attr("class").split(" "),function(b){if(b.match(/item_.+/)){var b=b.split("_")[1],d="";switch(c.tag().toLowerCase()){case "input":case "checkbox":case "textarea":case "select":d=c.val();break;case "img":d=c.attr("src");break;default:d=c.text()}a[b.toLowerCase()]=d}})});b.add(a)}}];b.extend({bindOutlets:function(a){b.each(a,function(a,e,c){b.bind("update",function(){b.setOutlet("."+o+"_"+c,a.callback)})})},setOutlet:function(a,d){var e=d.call(b,a);r(e)&&e.el?b.$(a).html(" ").append(e):c(e)|| -b.$(a).text(e)},bindInputs:function(a){b.each(a,function(a){b.setInput("."+o+"_"+a.selector,a.event,a.callback)})},setInput:function(a,d,e){b.$(a).live(d,e)}});var f=b.ELEMENT=function(a){this.create(a);this.selector=a||null},B={MooTools:{text:function(a){return this.attr("text",a)},html:function(a){return this.attr("html",a)},val:function(a){return this.attr("value",a)},attr:function(a,b){return c(b)?this.el.get(a):(this.el.set(a,b),this)},remove:function(){this.el.dispose();return null},addClass:function(a){this.el.addClass(a); +b.$(a).html(e)},bindInputs:function(a){b.each(a,function(a){b.setInput("."+o+"_"+a.selector,a.event,a.callback)})},setInput:function(a,d,e){b.$(a).live(d,e)}});var f=b.ELEMENT=function(a){this.create(a);this.selector=a||null},B={MooTools:{text:function(a){return this.attr("text",a)},html:function(a){return this.attr("html",a)},val:function(a){return this.attr("value",a)},attr:function(a,b){return c(b)?this.el.get(a):(this.el.set(a,b),this)},remove:function(){this.el.dispose();return null},addClass:function(a){this.el.addClass(a); return this},removeClass:function(a){this.el.removeClass(a);return this},append:function(a){this.el.adopt(a.el);return this},each:function(a){i(a)&&b.each(this.el,a);return this},click:function(a){i(a)?this.each(function(b){b.addEvent("click",function(e){a.call(b,e)})}):c(a)&&this.el.fireEvent("click");return this},live:function(a,d){var e=this.selector;i(d)&&b.$(document).el.addEvent(a,function(a){var c=b.$(a.target);c.match(e)&&d.call(c,a)})},match:function(a){return this.el.match(a)},parent:function(){return b.$(this.el.getParent())}, -find:function(a){return b.$(this.el.getElements(a))},closest:function(a){return b.$(this.el.getParent(a))},descendants:function(){return this.find("*")},tag:function(){return this.el[0].tagName},create:function(a){this.el=l(a)}},Prototype:{text:function(a){return c(a)?this.el[0].innerHTML:(this.each(function(b){$(b).update(a)}),this)},html:function(a){return this.text(a)},val:function(a){return this.attr("value",a)},attr:function(a,b){return c(b)?this.el[0].readAttribute(a):(this.each(function(e){$(e).writeAttribute(a, +find:function(a){return b.$(this.el.getElements(a))},closest:function(a){return b.$(this.el.getParent(a))},descendants:function(){return this.find("*")},tag:function(){return this.el[0].tagName},create:function(a){this.el=l(a)}},Prototype:{text:function(a){return c(a)?this.el[0].innerHTML:(this.each(function(b){$(b).update(a)}),this)},html:function(a){return this.html(a)},val:function(a){return this.attr("value",a)},attr:function(a,b){return c(b)?this.el[0].readAttribute(a):(this.each(function(e){$(e).writeAttribute(a, b)}),this)},append:function(a){this.each(function(b){a.el?a.each(function(a){$(b).appendChild(a)}):v(a)&&$(b).appendChild(a)});return this},remove:function(){this.each(function(a){$(a).remove()});return this},addClass:function(a){this.each(function(b){$(b).addClassName(a)});return this},removeClass:function(a){this.each(function(b){$(b).removeClassName(a)});return this},each:function(a){i(a)&&b.each(this.el,a);return this},click:function(a){i(a)?this.each(function(b){$(b).observe("click",function(e){a.call(b, e)})}):c(a)&&this.each(function(a){$(a).fire("click")});return this},live:function(a,b){if(i(b)){var e=this.selector;document.observe(a,function(a,c){c==l(a).findElement(e)&&b.call(c,a)})}},parent:function(){return b.$(this.el.up())},find:function(a){return b.$(this.el.getElementsBySelector(a))},closest:function(a){return b.$(this.el.up(a))},descendants:function(){return b.$(this.el.descendants())},tag:function(){return this.el.tagName},create:function(a){if(k(a))this.el=l(a);else if(v(a))this.el= [$(a)]}},jQuery:{passthrough:function(a,b){return c(b)?this.el[a]():(this.el[a](b),this)},text:function(a){return this.passthrough("text",a)},html:function(a){return this.passthrough("html",a)},val:function(a){return this.passthrough("val",a)},append:function(a){this.el.append(a.el||a);return this},attr:function(a,b){return c(b)?this.el.attr(a):(this.el.attr(a,b),this)},remove:function(){this.el.remove();return this},addClass:function(a){this.el.addClass(a);return this},removeClass:function(a){this.el.removeClass(a);