Commits

Bertrand Le Roy committed c88a2c0

Client-side cart events added.

Comments (0)

Files changed (4)

Nwazet.Commerce.csproj

       <LastGenOutput>shoppingcart.min.js</LastGenOutput>
     </Content>
     <Content Include="Scripts\shoppingcart.min.js">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
       <DependentUpon>shoppingcart.js</DependentUpon>
     </Content>
     <Content Include="Styles\bundle.nwazet-commerce-admin.css" />
     <Content Include="Views\TitleWithLink.cshtml" />
   </ItemGroup>
   <ItemGroup>
+    <None Include="Scripts\shoppingcart.min.js.map">
+      <DependentUpon>shoppingcart.js</DependentUpon>
+    </None>
     <None Include="Views\AttributesAdmin\Index.cshtml" />
     <Content Include="Views\EditorTemplates\Parts\ProductAttribute.cshtml" />
     <Content Include="Views\EditorTemplates\Parts\ProductAttributes.cshtml" />

Scripts/shoppingcart.js

     }
 
     $(".shoppingcart .delete").live("click", function () {
+        $(this).trigger("nwazet.removefromcart");
         setQuantityToZero("tr")($(this)).submit();
     });
 
     }
 
     function onload(text) {
+        $(this).trigger("nwazet.cartupdated");
         mini.parent().toggle(text.trim().length > 0);
     }
 
     $(".minicart .delete").live("click", function () {
+        $(this).trigger("nwazet.removefromcart");
         return miniLoad(setQuantityToZero("li")($(this)));
     });
 
     $(".minicart .update-button, .addtocart-button").live("click", function () {
+        $(this).trigger("nwazet.addtocart");
         return miniLoad($(this).parents("form"));
     });
 });

Scripts/shoppingcart.min.js

-jQuery(function(a){function c(a){return function(b){return b.parents(a+":first").find("input.quantity").val(0).parents("form")}}function d(a){b.load(a.attr("action"),a.serializeArray(),e);return!1}function e(a){b.parent().toggle(0<a.trim().length)}a(".shoppingcart .delete").live("click",function(){c("tr")(a(this)).submit()});var b=a(".minicart");b.load(b.data("url"),e).parent().hide();a(".minicart .delete").live("click",function(){return d(c("li")(a(this)))});a(".minicart .update-button, .addtocart-button").live("click",
-function(){return d(a(this).parents("form"))})});
+jQuery(function(n){function i(n){return function(t){return t.parents(n+":first").find("input.quantity").val(0).parents("form")}}function r(n){return t.load(n.attr("action"),n.serializeArray(),u),!1}function u(i){n(this).trigger("nwazet.cartupdated"),t.parent().toggle(i.trim().length>0)}n(".shoppingcart .delete").live("click",function(){n(this).trigger("nwazet.removefromcart"),i("tr")(n(this)).submit()});var t=n(".minicart");t.load(t.data("url"),u).parent().hide(),n(".minicart .delete").live("click",function(){return n(this).trigger("nwazet.removefromcart"),r(i("li")(n(this)))}),n(".minicart .update-button, .addtocart-button").live("click",function(){return n(this).trigger("nwazet.addtocart"),r(n(this).parents("form"))})})
+//@ sourceMappingURL=shoppingcart.min.js.map

Scripts/shoppingcart.min.js.map

+{
+"version":3,
+"file":"shoppingcart.min.js",
+"lineCount":1,
+"mappings":"AAAAA,MAAM,CAAC,QAAS,CAACC,CAAD,CAAI,CAChBC,SAASA,CAAiB,CAACC,CAAD,CAAY,CAClC,OAAO,QAAS,CAACC,CAAD,CAAS,CACrB,OAAOA,CAAMC,QAAQ,CAACF,CAAU,CAAE,QAAb,CACjBG,KAAK,CAAC,gBAAD,CAAkBC,IAAI,CAAC,CAAD,CAC3BF,QAAQ,CAAC,MAAD,CAHS,CADS,CAgBtCG,SAASA,CAAQ,CAACC,CAAD,CAAO,CAEpB,OADAC,CAAIC,KAAK,CAACF,CAAIG,KAAK,CAAC,QAAD,CAAU,CAAEH,CAAII,eAAe,CAAA,CAAE,CAAEC,CAA7C,CAAoD,CACtD,CAAA,CAFa,CAKxBA,SAASA,CAAM,CAACC,CAAD,CAAO,CAClBd,CAAC,CAAC,IAAD,CAAMe,QAAQ,CAAC,oBAAD,CAAsB,CACrCN,CAAIO,OAAO,CAAA,CAAEC,OAAO,CAACH,CAAII,KAAK,CAAA,CAAEC,OAAQ,CAAE,CAAtB,CAFF,CAbtBnB,CAAC,CAAC,uBAAD,CAAyBoB,KAAK,CAAC,OAAO,CAAE,QAAS,CAAA,CAAG,CACjDpB,CAAC,CAAC,IAAD,CAAMe,QAAQ,CAAC,uBAAD,CAAyB,CACxCd,CAAiB,CAAC,IAAD,CAAM,CAACD,CAAC,CAAC,IAAD,CAAF,CAASqB,OAAO,CAAA,CAFU,CAAtB,CAG7B,CAEF,IAAIZ,EAAOT,CAAC,CAAC,WAAD,CAAa,CACzBS,CAAIC,KAAK,CAACD,CAAIa,KAAK,CAAC,KAAD,CAAO,CAAET,CAAnB,CAA0BG,OAAO,CAAA,CAAEO,KAAK,CAAA,CAAE,CAYnDvB,CAAC,CAAC,mBAAD,CAAqBoB,KAAK,CAAC,OAAO,CAAE,QAAS,CAAA,CAAG,CAE7C,OADApB,CAAC,CAAC,IAAD,CAAMe,QAAQ,CAAC,uBAAD,CAAyB,CACjCR,CAAQ,CAACN,CAAiB,CAAC,IAAD,CAAM,CAACD,CAAC,CAAC,IAAD,CAAF,CAAxB,CAF8B,CAAtB,CAGzB,CAEFA,CAAC,CAAC,6CAAD,CAA+CoB,KAAK,CAAC,OAAO,CAAE,QAAS,CAAA,CAAG,CAEvE,OADApB,CAAC,CAAC,IAAD,CAAMe,QAAQ,CAAC,kBAAD,CAAoB,CAC5BR,CAAQ,CAACP,CAAC,CAAC,IAAD,CAAMI,QAAQ,CAAC,MAAD,CAAhB,CAFwD,CAAtB,CAhCrC,CAAd",
+"sources":["shoppingcart.js"],
+"names":["jQuery","$","setQuantityToZero","parentTag","button","parents","find","val","miniLoad","form","mini","load","attr","serializeArray","onload","text","trigger","parent","toggle","trim","length","live","submit","data","hide"]
+}