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

@ -0,0 +1,4 @@
<template name="listsMain">
<h4>My Lists</h4>
{{> listsTbl}}
</template>

16
client/Lists/listsMain.js Normal file
View file

@ -0,0 +1,16 @@
Template.listsMain.onCreated(function() {
});
Template.listsMain.onRendered(function() {
});
Template.listsMain.helpers({
});
Template.listsMain.events({
});

View file

@ -0,0 +1,26 @@
<template name="listsTbl">
<div class="row">
<div class="col s12">
<ul class="collection">
{{#each mylists}}
<li class="collection-item clickable" id="{{this._id}}">
<span class="{{#if $eq listShared true}}green-text{{/if}}">{{listName}}</span>
<i class="material-icons clickable markAsComplete right" id="check_{{this._id}}">check</i>
</li>
{{/each}}
<li class="collection-item clickable addNew" id="addList"> + Add New List</li>
</ul>
</div>
</div>
<!-- Modal for the Add List Option -->
<div id="modalList" class="modal">
<div class="modal-content">
<h4>Add New List</h4>
{{> listMgmtForm}}
</div>
<div class="modal-footer">
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Done</a>
</div>
</div>
{{> snackbar}}
</template>

57
client/Lists/listsTbl.js Normal file
View file

@ -0,0 +1,57 @@
import { Lists } from '../../imports/api/lists.js';
Template.listsTbl.onCreated(function() {
this.subscribe("myLists");
});
Template.listsTbl.onRendered(function() {
$('.modal').modal();
});
Template.listsTbl.helpers({
mylists: function() {
return Lists.find({});
},
});
Template.listsTbl.events({
'click li.collection-item' (event) {
event.preventDefault();
let sender = event.target;
// console.log("Sender origination from: ");
// console.log(sender.localName);
if (sender.localName == "li") {
let listId = event.currentTarget.id;
if (listId == "addList") {
$('#modalList').modal('open');
} else {
console.log("listId is: " + listId);
Session.set("listId", listId);
Meteor.setTimeout(function() {
FlowRouter.go('/listitems');
}, 100);
}
}
},
'click i.markAsComplete' (event) {
event.preventDefault();
let sender = event.target;
// console.log("Sender origination from: " );
// console.log(sender.localName);
if (sender.localName == "i") {
let listFullId = event.currentTarget.id;
let splitList = listFullId.split("_");
let listId = splitList[1];
// console.log("listId is " + listId);
Meteor.call("mark.complete", listId, function(err, result){
if (err) {
console.log(" ERROR marking list complete! " + err);
showSnackbar("ERROR! List Not Makred Complete!", "red");
} else {
console.log(" SUCCESS marking list complete.");
showSnackbar("List Marked Complete!", "green");
}
});
}
}
});