mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Lots of changes and additions to the project. Still early, and not usable.
This commit is contained in:
parent
8636f8cf9b
commit
266dbd0856
41 changed files with 836 additions and 67 deletions
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
39
client/AdminMgmt/CategoryMgMt/catMgmtForm.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Categories } from '../../../imports/api/category.js';
|
||||
|
||||
Template.catMgmtForm.onCreated(function() {
|
||||
this.subscribe("myCategories");
|
||||
});
|
||||
|
||||
Template.catMgmtForm.onRendered(function() {
|
||||
Session.set("catNameMiss", false);
|
||||
});
|
||||
|
||||
Template.catMgmtForm.helpers({
|
||||
catNameErr: function() {
|
||||
return Session.get("catNameMiss");
|
||||
},
|
||||
});
|
||||
|
||||
Template.catMgmtForm.events({
|
||||
'click .saveCatMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let catName = $("#catNameInp").val();
|
||||
if (catName == null || catName == "") {
|
||||
Session.set("catNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('add.category', catName, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: Can't add category: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESS adding category.");
|
||||
$("#catNameInp").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .cancelCatMgmt' (event) {
|
||||
event.preventDefault();
|
||||
$("#catNameInp").val("");
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue