diff --git a/ko-cart/index.html b/ko-cart/index.html index f4c56b8..181d03d 100644 --- a/ko-cart/index.html +++ b/ko-cart/index.html @@ -21,200 +21,6 @@
- - - - - - - - - diff --git a/ko-cart/js/viewmodel.js b/ko-cart/js/viewmodel.js index 810640c..9a5828d 100644 --- a/ko-cart/js/viewmodel.js +++ b/ko-cart/js/viewmodel.js @@ -134,4 +134,26 @@ var vm = (function () { visibleCart: visibleCart }; })(); -ko.applyBindings(vm); + +var templates = [ + 'header', + 'catalog', + 'cart', + 'cart-item', + 'cart-widget', + 'order', + 'add-to-catalog-modal', + 'finish-order-modal' +]; + +var busy = templates.length; +templates.forEach(function(tpl){ + "use strict"; + $.get('views/' + tpl + '.html').then(function(data) { + $('body').append(data); + busy--; + if (!busy) { + ko.applyBindings(vm); + } + }) +}) \ No newline at end of file diff --git a/ko-cart/views/add-to-catalog-modal.html b/ko-cart/views/add-to-catalog-modal.html new file mode 100644 index 0000000..a8df684 --- /dev/null +++ b/ko-cart/views/add-to-catalog-modal.html @@ -0,0 +1,76 @@ + diff --git a/ko-cart/views/cart-item.html b/ko-cart/views/cart-item.html new file mode 100644 index 0000000..1f3f6d5 --- /dev/null +++ b/ko-cart/views/cart-item.html @@ -0,0 +1,36 @@ + diff --git a/ko-cart/views/cart-widget.html b/ko-cart/views/cart-widget.html new file mode 100644 index 0000000..6e8491f --- /dev/null +++ b/ko-cart/views/cart-widget.html @@ -0,0 +1,4 @@ + diff --git a/ko-cart/views/cart.html b/ko-cart/views/cart.html new file mode 100644 index 0000000..9032529 --- /dev/null +++ b/ko-cart/views/cart.html @@ -0,0 +1,18 @@ + diff --git a/ko-cart/views/catalog.html b/ko-cart/views/catalog.html new file mode 100644 index 0000000..6f4df0e --- /dev/null +++ b/ko-cart/views/catalog.html @@ -0,0 +1,48 @@ + diff --git a/ko-cart/views/finish-order-modal.html b/ko-cart/views/finish-order-modal.html new file mode 100644 index 0000000..33bb66e --- /dev/null +++ b/ko-cart/views/finish-order-modal.html @@ -0,0 +1,24 @@ + diff --git a/ko-cart/views/header.html b/ko-cart/views/header.html new file mode 100644 index 0000000..12a358f --- /dev/null +++ b/ko-cart/views/header.html @@ -0,0 +1,18 @@ + diff --git a/ko-cart/views/order.html b/ko-cart/views/order.html new file mode 100644 index 0000000..c308ce8 --- /dev/null +++ b/ko-cart/views/order.html @@ -0,0 +1,36 @@ +