Skip to content

Instantly share code, notes, and snippets.

@qrobin
Created December 28, 2015 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrobin/744b434ee969ebdc7134 to your computer and use it in GitHub Desktop.
Save qrobin/744b434ee969ebdc7134 to your computer and use it in GitHub Desktop.
<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>
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