mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Added a delete confirmation modal to all views.
This commit is contained in:
parent
4d9d2acff6
commit
29ddc544e5
27 changed files with 117 additions and 127 deletions
|
|
@ -1,16 +1,11 @@
|
|||
<template name="catMgmtForm">
|
||||
<form action="submit" id="catInputForm">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<div class="col s8 m10 l10 input-field">
|
||||
<input type="text" class="catNameInp" id="catNameInp" style="{{#if $eq catNameErr true}}border: 2px solid red;{{/if}}" />
|
||||
<label for="catNameInp">Name*</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<div class="col s4 m2 l2 input-field">
|
||||
{{#if $eq catEditMode false}}
|
||||
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -19,13 +19,11 @@ Template.catMgmtTbl.helpers({
|
|||
Template.catMgmtTbl.events({
|
||||
'click .deleteCategory' (event) {
|
||||
event.preventDefault();
|
||||
Meteor.call('delete.category', this._id, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting category: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting the category.");
|
||||
}
|
||||
});
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.category");
|
||||
Session.set("item", this.categoryName);
|
||||
Session.set("view", "Categories");
|
||||
$('#modalDelete').modal('open');
|
||||
},
|
||||
'click .editCategory' (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ Template.listMgmtForm.events({
|
|||
} else {
|
||||
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
// console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
// console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
}
|
||||
|
|
@ -51,9 +51,9 @@ Template.listMgmtForm.events({
|
|||
} else {
|
||||
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
// console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
// console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
|
|
@ -75,9 +75,9 @@ Template.listMgmtForm.events({
|
|||
if (editMode == false) {
|
||||
Meteor.call('add.list', listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR adding list name: " + err);
|
||||
// console.log(" ERROR adding list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS adding list name.");
|
||||
// console.log(" SUCCESS adding list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
}
|
||||
|
|
@ -85,9 +85,9 @@ Template.listMgmtForm.events({
|
|||
} else {
|
||||
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR editing list name: " + err);
|
||||
// console.log(" ERROR editing list name: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS editing list name.");
|
||||
// console.log(" SUCCESS editing list name.");
|
||||
$("#listNameInp").val("");
|
||||
$("#isShared").prop("checked", false);
|
||||
Session.set("listNameEditMode", false);
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -19,14 +19,12 @@ Template.listMgmtTbl.helpers({
|
|||
Template.listMgmtTbl.events({
|
||||
'click .deleteListName' (event) {
|
||||
event.preventDefault();
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.list");
|
||||
Session.set("item", this.listName);
|
||||
Session.set("view", "Lists");
|
||||
$('#modalDelete').modal('open');
|
||||
let listId = this._id;
|
||||
Meteor.call('delete.list', listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting list: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting list.");
|
||||
}
|
||||
});
|
||||
},
|
||||
'click .editListName' (event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -47,9 +45,9 @@ Template.listMgmtTbl.events({
|
|||
let listId = this._id;
|
||||
Meteor.call('mark.complete', listId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR marking complete: " + err);
|
||||
// console.log(" ERROR marking complete: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS marking complete.");
|
||||
// console.log(" SUCCESS marking complete.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
<template name="locMgmtForm">
|
||||
<form action="" id="locInputForm">
|
||||
<div class="row">
|
||||
<div class="col s12 m6 l6 input-field">
|
||||
<div class="col s8 m10 l10 input-field">
|
||||
<input type="text" class="locNameInp" id="locNameInp" style="{{#if $eq locNameErr true}}border: 2px solid red;{{/if}}" />
|
||||
<label for="locNameInp">Name*</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<div class="col s4 m2 l2 input-field">
|
||||
{{#if $eq locEditMode false}}
|
||||
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -19,13 +19,11 @@ Template.locMgmtTbl.helpers({
|
|||
Template.locMgmtTbl.events({
|
||||
'click .deleteLocation' (event) {
|
||||
event.preventDefault();
|
||||
Meteor.call('delete.location', this._id, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting location: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting the location.");
|
||||
}
|
||||
});
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.location");
|
||||
Session.set("item", this.locationName);
|
||||
Session.set("view", "Locations");
|
||||
$('#modalDelete').modal('open');
|
||||
},
|
||||
'click .editLocation' (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -36,4 +36,5 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -28,13 +28,11 @@ Template.prodMgmtTbl.helpers({
|
|||
Template.prodMgmtTbl.events({
|
||||
'click .deleteProduct' (event) {
|
||||
event.preventDefault();
|
||||
Meteor.call('delete.product', this._id, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting product: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting the product.");
|
||||
}
|
||||
});
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.product");
|
||||
Session.set("item", this.prodName);
|
||||
Session.set("view", "Products");;
|
||||
$('#modalDelete').modal('open');
|
||||
},
|
||||
'click .editProduct' (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
<template name="storeMgmtForm">
|
||||
<form id="storeForm" action="submit">
|
||||
<div class="row">
|
||||
<div class="col s12 input-field">
|
||||
<div class="col s8 m10 l10 input-field">
|
||||
<input type="text" class="storeName" id="storeName" />
|
||||
<label for="storeName">Name</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<div class="col s4 m2 l2 input-field">
|
||||
{{#if $eq editModeStore false}}
|
||||
<a class="waves-effect waves-light btn saveStoreMgmt green right">Add</a>
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -19,13 +19,11 @@ Template.storeMgmtTbl.helpers({
|
|||
Template.storeMgmtTbl.events({
|
||||
'click .deleteStore' (event) {
|
||||
event.preventDefault();
|
||||
Meteor.call('delete.store', this._id, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting store: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting the store.");
|
||||
}
|
||||
});
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.store");
|
||||
Session.set("item", this.storeName);
|
||||
Session.set("view", "Stores");
|
||||
$('#modalDelete').modal('open');
|
||||
},
|
||||
'click .editStore' (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
|||
18
client/General/DeleteConfModal/deleteConfirmationModal.html
Normal file
18
client/General/DeleteConfModal/deleteConfirmationModal.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<template name="deleteConfirmationModal">
|
||||
<div id="modalDelete" class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Delete Confirmation</h4>
|
||||
You are about to permanently delete {{itemName}} from the {{viewName}} list. Are you sure?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="modal-close waves-effect waves-light btn left cancelDelete orange">Cancel</a>
|
||||
</div>
|
||||
<div class="col s6 m6 l6">
|
||||
<a class="waves-effect waves-light btn confirmDelete red right">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
33
client/General/DeleteConfModal/deleteConfirmationModal.js
Normal file
33
client/General/DeleteConfModal/deleteConfirmationModal.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
Template.deleteConfirmationModal.onCreated(function() {
|
||||
|
||||
});
|
||||
|
||||
Template.deleteConfirmationModal.onRendered(function() {
|
||||
$('.modal').modal();
|
||||
});
|
||||
|
||||
Template.deleteConfirmationModal.helpers({
|
||||
itemName: function() {
|
||||
return Session.get("item");
|
||||
},
|
||||
viewName: function() {
|
||||
return Session.get("view");
|
||||
}
|
||||
});
|
||||
|
||||
Template.deleteConfirmationModal.events({
|
||||
'click .confirmDelete' (event) {
|
||||
event.preventDefault();
|
||||
let deleteId = Session.get("deleteId");
|
||||
let method = Session.get("method");
|
||||
|
||||
Meteor.call(method, deleteId, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting item from modal: " + err);
|
||||
} else {
|
||||
// console.log(" SUCCESSFULLY deleted.");
|
||||
$('#modalDelete').modal('close');
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
@ -26,11 +26,11 @@ Template.headerBar.events({
|
|||
'click .navBtn' (event) {
|
||||
event.preventDefault();
|
||||
var clickedTarget = event.target.id;
|
||||
console.log("clicked " + clickedTarget);
|
||||
// console.log("clicked " + clickedTarget);
|
||||
if (clickedTarget == 'mainMenu') {
|
||||
FlowRouter.go('/');
|
||||
} else {
|
||||
console.log("should be going to /" + clickedTarget);
|
||||
// console.log("should be going to /" + clickedTarget);
|
||||
FlowRouter.go('/' + clickedTarget);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,4 +18,5 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{> deleteConfirmationModal}}
|
||||
</template>
|
||||
|
|
@ -7,6 +7,7 @@ Template.listItemsTbl.onCreated(function() {
|
|||
});
|
||||
|
||||
Template.listItemsTbl.onRendered(function() {
|
||||
$('.modal').modal();
|
||||
Session.set("showReceivedItems", false);
|
||||
Session.set("searchVal", "");
|
||||
});
|
||||
|
|
@ -40,7 +41,7 @@ Template.listItemsTbl.events({
|
|||
if (err) {
|
||||
console.log(" ERROR setting this item as NOT ordered: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS setting this item as NOT ordered.");
|
||||
// console.log(" SUCCESS setting this item as NOT ordered.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
@ -48,7 +49,7 @@ Template.listItemsTbl.events({
|
|||
if (err) {
|
||||
console.log(" ERROR marking item ordered: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS marking this item ordered.");
|
||||
// console.log(" SUCCESS marking this item ordered.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -59,18 +60,16 @@ Template.listItemsTbl.events({
|
|||
if (err) {
|
||||
console.log(" ERROR setting item as received: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS setting item received.");
|
||||
// console.log(" SUCCESS setting item received.");
|
||||
}
|
||||
});
|
||||
},
|
||||
'click .deleteListItem' (event) {
|
||||
event.preventDefault();
|
||||
Meteor.call('delete.listItem', this._id, function(err, result) {
|
||||
if (err) {
|
||||
console.log(" ERROR deleting the list item: " + err);
|
||||
} else {
|
||||
console.log(" SUCCESS deleting the list item.");
|
||||
}
|
||||
});
|
||||
Session.set("deleteId", this._id);
|
||||
Session.set("method", "delete.listItem");
|
||||
Session.set("item", this.itemName);
|
||||
Session.set("view", "List Items");
|
||||
$('#modalDelete').modal('open');
|
||||
},
|
||||
});
|
||||
|
|
@ -48,7 +48,7 @@ Template.listsTbl.events({
|
|||
console.log(" ERROR marking list complete! " + err);
|
||||
showSnackbar("ERROR! List Not Makred Complete!", "red");
|
||||
} else {
|
||||
console.log(" SUCCESS marking list complete.");
|
||||
// console.log(" SUCCESS marking list complete.");
|
||||
showSnackbar("List Marked Complete!", "green");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue