mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +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>
|
<h4>Lists</h4>
|
||||||
<form action="submit" class="listAdd">
|
<form action="submit" class="listAdd">
|
||||||
<div class="row">
|
<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" />
|
<input type="text" class="listNameInp" style="{{#if $eq listNameErr true}}border: 2px solid red{{/if}}" id="listNameInp" />
|
||||||
<label for="listNameInp">List Name</label>
|
<label for="listNameInp">List Name</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col s4 m4 l2 input-field">
|
<div class="col s12 m2 l2 input-field">
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="isShared"/>
|
<input type="checkbox" id="isShared"/>
|
||||||
|
|
@ -14,6 +14,14 @@
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</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>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col s12 m12 l12">
|
<div class="col s12 m12 l12">
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ Template.listMgmtForm.onCreated(function() {
|
||||||
Template.listMgmtForm.onRendered(function() {
|
Template.listMgmtForm.onRendered(function() {
|
||||||
Session.set("listNameMiss", false);
|
Session.set("listNameMiss", false);
|
||||||
Session.set("listNameEditMode", false);
|
Session.set("listNameEditMode", false);
|
||||||
|
Session.set("showCompletedLists", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.listMgmtForm.helpers({
|
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 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 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 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>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -21,6 +22,9 @@
|
||||||
<div id="markCompleteIcon" style="display: none;">
|
<div id="markCompleteIcon" style="display: none;">
|
||||||
Mark list complete
|
Mark list complete
|
||||||
</div>
|
</div>
|
||||||
|
<div id="markIncompleteIcon" style="display: none;">
|
||||||
|
Restore Completed List
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{> deleteConfirmationModal}}
|
{{> deleteConfirmationModal}}
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -2,7 +2,7 @@ import { Lists } from '../../../imports/api/lists.js';
|
||||||
import { M } from '../../lib/assets/materialize.js';
|
import { M } from '../../lib/assets/materialize.js';
|
||||||
|
|
||||||
Template.listMgmtTbl.onCreated(function() {
|
Template.listMgmtTbl.onCreated(function() {
|
||||||
this.subscribe("myLists");
|
this.subscribe("allLists");
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.listMgmtTbl.onRendered(function() {
|
Template.listMgmtTbl.onRendered(function() {
|
||||||
|
|
@ -14,7 +14,12 @@ Template.listMgmtTbl.onRendered(function() {
|
||||||
|
|
||||||
Template.listMgmtTbl.helpers({
|
Template.listMgmtTbl.helpers({
|
||||||
lists: function() {
|
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.");
|
// 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,
|
listComplete: true,
|
||||||
completedOn: new Date()
|
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' () {
|
'clean.Lists' () {
|
||||||
if (!this.userId) {
|
if (!this.userId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue