diff --git a/client/AdminMgmt/ListMgmt/listMgmtForm.js b/client/AdminMgmt/ListMgmt/listMgmtForm.js
index ece9583..5c8bd7c 100644
--- a/client/AdminMgmt/ListMgmt/listMgmtForm.js
+++ b/client/AdminMgmt/ListMgmt/listMgmtForm.js
@@ -7,6 +7,7 @@ Template.listMgmtForm.onCreated(function() {
Template.listMgmtForm.onRendered(function() {
Session.set("listNameMiss", false);
Session.set("listNameEditMode", false);
+ Session.set("showCompletedLists", false);
});
Template.listMgmtForm.helpers({
@@ -95,5 +96,8 @@ Template.listMgmtForm.events({
});
}
}
- }
+ },
+ 'change #isCompleted' (event) {
+ Session.set("showCompletedLists", true);
+ },
});
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtTbl.html b/client/AdminMgmt/ListMgmt/listMgmtTbl.html
index 7011beb..a3d9577 100644
--- a/client/AdminMgmt/ListMgmt/listMgmtTbl.html
+++ b/client/AdminMgmt/ListMgmt/listMgmtTbl.html
@@ -8,6 +8,7 @@
delete
edit
check
+
refresh
{{/each}}
@@ -21,6 +22,9 @@
Mark list complete
+
+ Restore Completed List
+
{{> deleteConfirmationModal}}
\ No newline at end of file
diff --git a/client/AdminMgmt/ListMgmt/listMgmtTbl.js b/client/AdminMgmt/ListMgmt/listMgmtTbl.js
index d737894..fb348a8 100644
--- a/client/AdminMgmt/ListMgmt/listMgmtTbl.js
+++ b/client/AdminMgmt/ListMgmt/listMgmtTbl.js
@@ -2,7 +2,7 @@ import { Lists } from '../../../imports/api/lists.js';
import { M } from '../../lib/assets/materialize.js';
Template.listMgmtTbl.onCreated(function() {
- this.subscribe("myLists");
+ this.subscribe("allLists");
});
Template.listMgmtTbl.onRendered(function() {
@@ -14,7 +14,12 @@ Template.listMgmtTbl.onRendered(function() {
Template.listMgmtTbl.helpers({
lists: function() {
- return Lists.find({});
+ let showComplete = Session.get("showCompletedLists");
+ if (showComplete) {
+ return Lists.find({ listComplete: true });
+ } else {
+ return Lists.find({});
+ }
}
});
@@ -51,5 +56,16 @@ Template.listMgmtTbl.events({
// console.log(" SUCCESS marking complete.");
}
});
+ },
+ 'click .markListNotComplete' (event) {
+ event.preventDefault();
+ let listId = this._id;
+ Meteor.call('mark.incomplete', listId, function(err, result) {
+ if (err) {
+
+ } else {
+
+ }
+ });
}
});
\ No newline at end of file
diff --git a/imports/api/lists.js b/imports/api/lists.js
index 6b8651d..1c02722 100644
--- a/imports/api/lists.js
+++ b/imports/api/lists.js
@@ -64,7 +64,21 @@ Meteor.methods({
listComplete: true,
completedOn: new Date()
}
- });;
+ });
+ },
+ 'mark.incomplete' (listId) {
+ check(listId, String);
+
+ if (!this.userId) {
+ throw new Meteor.Error('You are not allowed to restore completed lists. Make sure you are logged in with valid user credentials.');
+ }
+
+ return Lists.update({ _id: listId }, {
+ $set: {
+ listComplete: false,
+ completedOn: new Date()
+ }
+ });
},
'clean.Lists' () {
if (!this.userId) {