get_my/client/AdminMgmt/ListMgmt/listMgmtTbl.js

54 lines
1.6 KiB
JavaScript
Raw Normal View History

import { Lists } from '../../../imports/api/lists.js';
Template.listMgmtTbl.onCreated(function() {
this.subscribe("myLists");
});
Template.listMgmtTbl.onRendered(function() {
Meteor.setTimeout(function() {
$('.tooltipped').tooltip();
}, 150);
});
Template.listMgmtTbl.helpers({
lists: function() {
return Lists.find({});
}
});
Template.listMgmtTbl.events({
'click .deleteListName' (event) {
event.preventDefault();
Session.set("deleteId", this._id);
Session.set("method", "delete.list");
Session.set("item", this.listName);
Session.set("view", "Lists");
$('#modalDelete').modal('open');
let listId = this._id;
},
'click .editListName' (event) {
event.preventDefault();
let listInfo = Lists.findOne({ _id: this._id });
let listName = listInfo.listName;
let listShared = listInfo.listShared;
$("#listNameInp").val(listName);
if (listShared == true) {
$("#isShared").prop("checked", true);
} else {
$("#isShared").prop("checked", false);
}
Session.set("listNameEditMode", true);
Session.set("listItemId", this._id);
},
'click .markListComplete' (event) {
event.preventDefault();
let listId = this._id;
Meteor.call('mark.complete', listId, function(err, result) {
if (err) {
// console.log(" ERROR marking complete: " + err);
} else {
// console.log(" SUCCESS marking complete.");
}
});
}
});