diff --git a/app/components/modals/new-product.js b/app/components/modals/new-product.js new file mode 100644 index 0000000..2571a45 --- /dev/null +++ b/app/components/modals/new-product.js @@ -0,0 +1,8 @@ +import Component from '@ember/component'; + +export default Component.extend({ + init() { + this.set('product', {}); + this._super(...arguments); + } +}); diff --git a/app/controllers/storage.js b/app/controllers/storage.js new file mode 100644 index 0000000..e0a188c --- /dev/null +++ b/app/controllers/storage.js @@ -0,0 +1,12 @@ +import Controller from '@ember/controller'; +import { storageFor } from 'ember-local-storage'; +import { action } from '@ember/object'; + +export default class Storage extends Controller { + @storageFor('products') products; + + @action + onDelete(product) { + this.products.removeObject(product); + } +}; diff --git a/app/storages/products.js b/app/storages/products.js new file mode 100644 index 0000000..6a1a042 --- /dev/null +++ b/app/storages/products.js @@ -0,0 +1,12 @@ +import StorageArray from 'ember-local-storage/local/array'; + +const Storage = StorageArray.extend(); + +// Uncomment if you would like to set initialState +// Storage.reopenClass({ +// initialState() { +// return []; +// } +// }); + +export default Storage; \ No newline at end of file diff --git a/app/templates/components/modals/new-product.hbs b/app/templates/components/modals/new-product.hbs new file mode 100644 index 0000000..d0b0040 --- /dev/null +++ b/app/templates/components/modals/new-product.hbs @@ -0,0 +1,46 @@ + + +
+
+ Nie znaleziono produktu. Dodaj jako nowy. +
+ + + + + + +
+
+
diff --git a/app/templates/storage.hbs b/app/templates/storage.hbs new file mode 100644 index 0000000..e5046eb --- /dev/null +++ b/app/templates/storage.hbs @@ -0,0 +1,38 @@ +
+
+

+ Produkty +

+
+
+ + + + + + + + + + + {{#each this.products as |product|}} + + + + + + + + + {{/each}} + +
NazwaBiałkoWęglowodanyTłuszczkcal
{{product.name}}{{product.p}}{{product.c}}{{product.f}}{{product.kcal}} + +
+
+