Many chcanges, but version 0.1.0 is ready to be cut.

This commit is contained in:
Brian McGonagill 2022-08-23 13:41:21 -05:00
parent 42643a37f5
commit 6e37ae8c74
46 changed files with 1038 additions and 273 deletions

View file

@ -6,7 +6,17 @@
<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">
<div class="col s4 m4 l2 input-field">
<p>
<label>
<input type="checkbox" id="isShared"/>
<span>Shared</span>
</label>
</p>
</div>
</div>
<div class="row">
<div class="col s12 m12 l12">
{{#if $eq editMode false}}
<a class="waves-effect waves-light btn saveListMgmt green right">Add</a>
{{else}}

View file

@ -22,17 +22,19 @@ Template.listMgmtForm.events({
'click .saveListMgmt' (event) {
event.preventDefault();
let listName = $("#listNameInp").val();
let shared = $("#isShared").prop('checked');
if (listName == null || listName == "") {
Session.set("listNameMiss", true);
return;
} else {
Meteor.call('add.list', listName, function(err, result) {
Meteor.call('add.list', listName, shared, function(err, result) {
if (err) {
console.log(" ERROR adding list name: " + err);
} else {
console.log(" SUCCESS adding list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
}
});
}
@ -40,18 +42,20 @@ Template.listMgmtForm.events({
'click .renameListMgmt' (event) {
event.preventDefault();
let listName = $("#listNameInp").val();
let shared = $("#isShared").prop('checked');
let listId = Session.get("listItemId");
if (listName == null || listName == "") {
Session.set("listNameMiss", true);
return;
} else {
Meteor.call('edit.list', listId, listName, function(err, result) {
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
if (err) {
console.log(" ERROR editing list name: " + err);
} else {
console.log(" SUCCESS editing list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
Session.set("listNameEditMode", false);
}
});
@ -60,6 +64,7 @@ Template.listMgmtForm.events({
'submit .listAdd' (event) {
event.preventDefault();
let editMode = Session.get("listNameEditMode");
let shared = $("#isShared").prop("checked");
let listName = $("#listNameInp").val();
let listId = Session.get("listItemId");
@ -68,21 +73,23 @@ Template.listMgmtForm.events({
return;
} else {
if (editMode == false) {
Meteor.call('add.list', listName, function(err, result) {
Meteor.call('add.list', listName, shared, function(err, result) {
if (err) {
console.log(" ERROR adding list name: " + err);
} else {
console.log(" SUCCESS adding list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
}
});
} else {
Meteor.call('edit.list', listId, listName, function(err, result) {
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
if (err) {
console.log(" ERROR editing list name: " + err);
} else {
console.log(" SUCCESS editing list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
Session.set("listNameEditMode", false);
}
});

View file

@ -4,7 +4,7 @@
<ul class="collection">
{{#each lists}}
<li class="collection-item">
{{listName}}
<span class="{{#if $eq listShared true}}green-text{{/if}}">{{listName}}</span>
<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>

View file

@ -5,7 +5,9 @@ Template.listMgmtTbl.onCreated(function() {
});
Template.listMgmtTbl.onRendered(function() {
$('.tooltipped').tooltip();
Meteor.setTimeout(function() {
$('.tooltipped').tooltip();
}, 150);
});
Template.listMgmtTbl.helpers({
@ -28,8 +30,15 @@ Template.listMgmtTbl.events({
},
'click .editListName' (event) {
event.preventDefault();
let listName = Lists.findOne({ _id: this._id }).listName;
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);
},