Created
December 28, 2015 15:03
-
-
Save qrobin/744b434ee969ebdc7134 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="addPlace"> | |
<div class="containerr"> | |
<div class="roww"> | |
<div class="coll spann_6"> | |
{{> quickForm collection="Places" id="insertPlaces" type="insert" autocomplete="off"}} | |
</div> | |
<div class="coll spann_18"> | |
{{> reactiveTable id="a123321" settings=settings showColumnToggles=true}} | |
</div> | |
</div> | |
</div> | |
</template> | |
<template name="ChangePlaceDialog"> | |
{{> quickForm collection="Places" type="update" doc=this id='ChangePlaceDialog' autocomplete="off"}} | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.subscribe("Places"); | |
Template.addPlace.helpers({ | |
settings: function () { | |
return { | |
collection: Places, | |
rowsPerPage: 25, | |
showFilter: true, | |
fields: [{ | |
key: 'location', | |
label: 'Локация' | |
}, | |
{ | |
key: 'district', | |
label: 'Район' | |
}, | |
{ | |
key: 'place', | |
label: 'Место', | |
}, | |
{ | |
key: 'place_type', | |
label: 'Тип места' | |
}, | |
{ | |
key: 'from_center', | |
label: 'От центра' | |
}, | |
{ | |
key: 'delete', | |
label: 'Удалить', | |
fn: function () { | |
return new Spacebars.SafeString('<a class="delete">Удалить</a>') | |
} | |
}] | |
} | |
} | |
}); | |
Meteor.startup(function () { | |
changePlace = { | |
template: Template.ChangePlaceDialog, | |
title: "Изменить запись", | |
modalDialogClass: "modal-dialog", | |
modalBodyClass: "modal-body", | |
modalFooterClass: "modal-footer", | |
removeOnHide: true | |
}; | |
console.log(changePlace); | |
ChangePlace_modal = ReactiveModal.initDialog(changePlace); | |
}); | |
Template.addPlace.events({ | |
'click .reactive-table tbody tr': function (event) { | |
event.preventDefault(); | |
if (event.target.className == "delete") { | |
Places.remove(this._id) | |
} | |
}, | |
'dblclick .reactive-table tbody tr': function (event) { | |
event.preventDefault(); | |
ReVar = new ReactiveVar; | |
ReVar.set(this._id); | |
ChangePlace_modal.show(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment