mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Adding more methods and views, updated dashboards a bit. Still not ready
This commit is contained in:
parent
266dbd0856
commit
42643a37f5
23 changed files with 374 additions and 32 deletions
92
client/AdminMgmt/ListMgmt/listMgmtForm.js
Normal file
92
client/AdminMgmt/ListMgmt/listMgmtForm.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
import { Lists } from '../../../imports/api/lists.js';
|
||||
|
||||
Template.listMgmtForm.onCreated(function() {
|
||||
this.subscribe("myLists");
|
||||
});
|
||||
|
||||
Template.listMgmtForm.onRendered(function() {
|
||||
Session.set("listNameMiss", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
});
|
||||
|
||||
Template.listMgmtForm.helpers({
|
||||
listNameErr: function() {
|
||||
return Session.get("listNameMiss");
|
||||
},
|
||||
editMode: function() {
|
||||
return Session.get("listNameEditMode");
|
||||
}
|
||||
});
|
||||
|
||||
Template.listMgmtForm.events({
|
||||
'click .saveListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .renameListMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let listName = $("#listNameInp").val();
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'submit .listAdd' (event) {
|
||||
event.preventDefault();
|
||||
let editMode = Session.get("listNameEditMode");
|
||||
let listName = $("#listNameInp").val();
|
||||
let listId = Session.get("listItemId");
|
||||
|
||||
if (listName == null || listName == "") {
|
||||
Session.set("listNameMiss", true);
|
||||
return;
|
||||
} else {
|
||||
if (editMode == false) {
|
||||
Meteor.call('add.list', listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('edit.list', listId, listName, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
Session.set("listNameEditMode", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue