mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-26 15:58:50 +00:00
Added ability to restore a completed lilst from List Management. #27
This commit is contained in:
parent
dcd0074b28
commit
c9c96d214d
5 changed files with 52 additions and 6 deletions
|
|
@ -2,11 +2,11 @@
|
|||
<h4>Lists</h4>
|
||||
<form action="submit" class="listAdd">
|
||||
<div class="row">
|
||||
<div class="col s8 m8 l10 input-field">
|
||||
<div class="col s12 m8 l8 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 input-field">
|
||||
<div class="col s12 m2 l2 input-field">
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" id="isShared"/>
|
||||
|
|
@ -14,6 +14,14 @@
|
|||
</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col s12 m2 l2 input-field">
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" id="isCompleted"/>
|
||||
<span>Show Completed</span>
|
||||
</label>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m12 l12">
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
},
|
||||
});
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<i class="material-icons clickable deleteListName tooltipped right modal-trigger" data-position="top" data-tooltip-id="deleteListIcon" data-target="modalDelete">delete</i>
|
||||
<i class="material-icons clickable editListName tooltipped right" data-position="top" data-tooltip-id="editThisListIcon">edit</i>
|
||||
<i class="material-icons clickable markListComplete tooltipped right" data-position="top" data-tooltip-id="markCompleteIcon">check</i>
|
||||
<i class="material-icons clickable markListNotComplete tooltipped right" data-position="top" data-tooltip-id="markIncompleteIcon">refresh</i>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
|
@ -21,6 +22,9 @@
|
|||
<div id="markCompleteIcon" style="display: none;">
|
||||
Mark list complete
|
||||
</div>
|
||||
<div id="markIncompleteIcon" style="display: none;">
|
||||
Restore Completed List
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -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 {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue