From c024762fca5b4ad8558913513ffd31d8a891f955 Mon Sep 17 00:00:00 2001 From: Jordan Davis Date: Fri, 28 Aug 2015 12:52:27 -0700 Subject: [PATCH] add component, delete functionality --- components/ionList/ionList.js | 4 ++- components/ionListButton/ionListButton.html | 10 ++++++++ components/ionListButton/ionListButton.js | 27 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 components/ionListButton/ionListButton.html create mode 100644 components/ionListButton/ionListButton.js diff --git a/components/ionList/ionList.js b/components/ionList/ionList.js index 953b914..eb4ad16 100644 --- a/components/ionList/ionList.js +++ b/components/ionList/ionList.js @@ -23,8 +23,9 @@ Template.ionList.helpers({ Template.ionList.rendered = function() { - var list = this.$('.list')[0]; + var list = this.$('.list')[0]; new Slip(list); + //TODO: ensure not creating a slip list if unnecessary }; @@ -51,6 +52,7 @@ Template.ionList.events({ originalIndex = e.originalEvent.detail.originalIndex if (spliceIndex != originalIndex) { + template.data.collection.find({}, { sort: { order: 1 diff --git a/components/ionListButton/ionListButton.html b/components/ionListButton/ionListButton.html new file mode 100644 index 0000000..4f50706 --- /dev/null +++ b/components/ionListButton/ionListButton.html @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/components/ionListButton/ionListButton.js b/components/ionListButton/ionListButton.js new file mode 100644 index 0000000..e434322 --- /dev/null +++ b/components/ionListButton/ionListButton.js @@ -0,0 +1,27 @@ +Template.ionListButton.events({ + 'click .item-delete' : function(e, template){ + e.preventDefault(); + itemContext = Template.parentData(1); + template.data.collection._collection.remove({ + _id: itemContext._id + }, function(error, result) { }); + } +}) + +Template.ionListButton.helpers({ + classes: function(){ + + var classes = []; + + var action = this.action || 'delete'; + var side = this.side || 'left'; + + classes.push('item-' + action); + classes.push('item-' + side + '-edit'); + + classes.push('enable-pointer-events'); + + return classes.join(' '); + + } +}) \ No newline at end of file