mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
Many chcanges, but version 0.1.0 is ready to be cut.
This commit is contained in:
parent
42643a37f5
commit
6e37ae8c74
46 changed files with 1038 additions and 273 deletions
|
|
@ -6,12 +6,16 @@ Template.locMgmtForm.onCreated(function() {
|
|||
|
||||
Template.locMgmtForm.onRendered(function() {
|
||||
Session.set("locNameMiss", false);
|
||||
Session.set("locEditMode", false);
|
||||
});
|
||||
|
||||
Template.locMgmtForm.helpers({
|
||||
locNameErr: function() {
|
||||
return Session.get("locNameMiss");
|
||||
},
|
||||
locEditMode: function() {
|
||||
return Session.get("locEditMode");
|
||||
}
|
||||
});
|
||||
|
||||
Template.locMgmtForm.events({
|
||||
|
|
@ -32,8 +36,60 @@ Template.locMgmtForm.events({
|
|||
});
|
||||
}
|
||||
},
|
||||
'click .editLocMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let locName = $("#locNameInp").val();
|
||||
let locEditMode = Session.get("locEditMode");
|
||||
let locId = Session.get("locEditId");
|
||||
if (locName == null || locName == "") {
|
||||
Session.set("locNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('edit.location', locId, locName, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: Can't edit category: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS editing category.");
|
||||
$("#locNameInp").val("");
|
||||
Session.set("locEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'submit #locInputForm' (event) {
|
||||
event.preventDefault();
|
||||
let locName = $("#locNameInp").val();
|
||||
let locEditMode = Session.get("locEditMode");
|
||||
let locId = Session.get("locEditId");
|
||||
if (locName == null || locName == "") {
|
||||
Session.set("locNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
if (locEditMode == false) {
|
||||
Meteor.call('add.location', locName, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: Can't add category: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS adding category.");
|
||||
$("#locNameInp").val("");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('edit.location', locId, locName, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: Can't edit category: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS editing category.");
|
||||
$("#locNameInp").val("");
|
||||
Session.set("locEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
'click .cancelLocMgmt' (event) {
|
||||
event.preventDefault();
|
||||
$("#locNameInp").val("");
|
||||
Session.set("locEditMode", false);
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue