Skip to content

Commit

Permalink
Merge pull request #119 from CalNourish/apostrophe-fix
Browse files Browse the repository at this point in the history
Allow apostrophes in item names
  • Loading branch information
jschnapper authored Dec 10, 2019
2 parents a9d1ef7 + a1f753d commit 3d0ee75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/scripts/vol-inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $(document).ready(function() {
<tr>
<td><a href='#' onClick = "goToEditItem(\'${currentItem.barcode}\')">${currentItem.itemName}</a></td>
<td data-itemid='${currentItem.barcode}'>${currentItem.count}</td>
<td><button class="delete-button" type="button" onClick="deleteItem(\'${currentItem.barcode}\',\'${currentItem.itemName}\')"><i class="fa fa-trash"></i></button></td>
<td><button class="delete-button" type="button" onClick="deleteItem(\'${currentItem.barcode}\',\'${formatNameForHTML(currentItem.itemName)}\')"><i class="fa fa-trash"></i></button></td>
</tr>`)
}
// append to dom
Expand Down Expand Up @@ -58,7 +58,7 @@ $(document).ready(function() {
<tr>
<td><a href='#' onClick = "goToEditItem(\'${currentItem.barcode}\')">${currentItem.itemName}</a></td>
<td data-itemid='${currentItem.barcode}'>${currentItem.count}</td>
<td><button class="delete-button" type="button" onClick="deleteItem(\'${currentItem.barcode}\',\'${currentItem.itemName}\')"><i class="fa fa-trash"></i></button></td>
<td><button class="delete-button" type="button" onClick="deleteItem(\'${currentItem.barcode}\',\'${formatNameForHTML(currentItem.itemName)}\')"><i class="fa fa-trash"></i></button></td>
</tr>
`)
}
Expand Down Expand Up @@ -123,6 +123,10 @@ function standardizeName(itemName) {
return newName;
}

function formatNameForHTML(itemName) {
return itemName.replace(/'/g, "\\'")
}

function setOutOfStock(itemName, barcode) {
if (confirm("Set " + itemName + " to Out of Stock?")) {
return firebase.database().ref('/barcodes/').once('value').then(function(barcodesTable) {
Expand Down

0 comments on commit 3d0ee75

Please sign in to comment.