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
5
client/AdminMgmt/ListMgmt/listMgmt.html
Normal file
5
client/AdminMgmt/ListMgmt/listMgmt.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<template name="listMgmt">
|
||||
{{> listMgmtForm}}
|
||||
<hr>
|
||||
{{> listMgmtTbl}}
|
||||
</template>
|
||||
16
client/AdminMgmt/ListMgmt/listMgmt.js
Normal file
16
client/AdminMgmt/ListMgmt/listMgmt.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
Template.listMgmt.onCreated(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.onRendered(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.helpers({
|
||||
|
||||
});
|
||||
|
||||
Template.listMgmt.events({
|
||||
|
||||
});
|
||||
18
client/AdminMgmt/ListMgmt/listMgmtForm.html
Normal file
18
client/AdminMgmt/ListMgmt/listMgmtForm.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<template name="listMgmtForm">
|
||||
<h4>Lists</h4>
|
||||
<form action="submit" class="listAdd">
|
||||
<div class="row">
|
||||
<div class="col s8 m8 l10 input-field">
|
||||
<input type="text" class="listNameInp" style="{{#if $eq listNameErr true}}border: 2px solid red{{/if}}" id="listNameInp" />
|
||||
<label for="listNameInp">List Name</label>
|
||||
</div>
|
||||
<div class="col s4 m4 l2">
|
||||
{{#if $eq editMode false}}
|
||||
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
|
||||
{{else}}
|
||||
<a class="waves-effect waves-light btn renameListMgmt blue right">Rename</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
16
client/AdminMgmt/ListMgmt/listMgmtTbl.html
Normal file
16
client/AdminMgmt/ListMgmt/listMgmtTbl.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<template name="listMgmtTbl">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="collection">
|
||||
{{#each lists}}
|
||||
<li class="collection-item">
|
||||
{{listName}}
|
||||
<i class="material-icons clickable deleteListName tooltipped right" data-position="top" data-tooltip="Delete This List">delete</i>
|
||||
<i class="material-icons clickable editListName tooltipped right" data-position="top" data-tooltip="Edit This List">edit</i>
|
||||
<i class="material-icons clickable markListComplete tooltipped right" data-position="top" data-tooltip="Mark Complete">check</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
47
client/AdminMgmt/ListMgmt/listMgmtTbl.js
Normal file
47
client/AdminMgmt/ListMgmt/listMgmtTbl.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { Lists } from '../../../imports/api/lists.js';
|
||||
|
||||
Template.listMgmtTbl.onCreated(function() {
|
||||
this.subscribe("myLists");
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.onRendered(function() {
|
||||
$('.tooltipped').tooltip();
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.helpers({
|
||||
lists: function() {
|
||||
return Lists.find({});
|
||||
}
|
||||
});
|
||||
|
||||
Template.listMgmtTbl.events({
|
||||
'click .deleteListName' (event) {
|
||||
event.preventDefault();
|
||||
let listId = this._id;
|
||||
Meteor.call('delete.list', listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting list: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting list.");
|
||||
}
|
||||
});
|
||||
},
|
||||
'click .editListName' (event) {
|
||||
event.preventDefault();
|
||||
let listName = Lists.findOne({ _id: this._id }).listName;
|
||||
$("#listNameInp").val(listName);
|
||||
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.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue