mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-05-26 14:22:19 -06:00
add component, delete functionality
This commit is contained in:
parent
06afcbf7a1
commit
c024762fca
3 changed files with 40 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
10
components/ionListButton/ionListButton.html
Normal file
10
components/ionListButton/ionListButton.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<template name="ionListButton">
|
||||
|
||||
<!-- <div class="item-left-edit item-delete enable-pointer-events" > -->
|
||||
<div class="{{classes}}" >
|
||||
|
||||
<!-- <div class="{{classes}}"> -->
|
||||
{{> UI.contentBlock}}
|
||||
</div>
|
||||
|
||||
</template>
|
||||
27
components/ionListButton/ionListButton.js
Normal file
27
components/ionListButton/ionListButton.js
Normal file
|
|
@ -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(' ');
|
||||
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue