From c1dbd0e3d5113a51b994ad5bc3d9329eb030e6ab Mon Sep 17 00:00:00 2001 From: Ryan Strat Date: Wed, 11 Feb 2015 16:46:11 -0500 Subject: [PATCH 1/4] Convert absolute url to relative url --- js/inventory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/inventory.js b/js/inventory.js index dffb67c..968e3f4 100644 --- a/js/inventory.js +++ b/js/inventory.js @@ -4,7 +4,7 @@ $(document).ready(function () { var engine = new Bloodhound({ name: 'parts', - remote: 'http://dev.rj.str.at/livesearch?q=%QUERY', + remote: '/livesearch?q=%QUERY', //remote: 'http://rj.localhost/livesearch?q=%QUERY', datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.val); From 400372785765dab7ee6078cd34daf51e673e12d1 Mon Sep 17 00:00:00 2001 From: Ryan Strat Date: Sun, 15 Feb 2015 15:35:40 -0500 Subject: [PATCH 2/4] Fix for #57. No longer checks the number of barcodes added --- js/add.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/add.js b/js/add.js index d8ace0e..08ef3cc 100644 --- a/js/add.js +++ b/js/add.js @@ -285,8 +285,6 @@ function validateBarcode() { } }); - flag = flag && $("#barcode table tbody tr").length > 1; - return flag; } From a906010e4e7835d713842b6da30e92f780c46f51 Mon Sep 17 00:00:00 2001 From: Ryan Strat Date: Sun, 15 Feb 2015 15:39:53 -0500 Subject: [PATCH 3/4] #57 enable button by default --- templates/add.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/add.php b/templates/add.php index 5e515db..12c5425 100644 --- a/templates/add.php +++ b/templates/add.php @@ -235,7 +235,7 @@ class="sr-only">Close
-
+
From d9cf7dd16db76f39a9c71c91af61c7ddb4e6ae37 Mon Sep 17 00:00:00 2001 From: Ryan Strat Date: Sun, 15 Feb 2015 16:42:07 -0500 Subject: [PATCH 4/4] Fix for #60. Additional improvements to colorization and validation of all inputs on the edit-details card. --- js/add.js | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/js/add.js b/js/add.js index 08ef3cc..5573b7d 100644 --- a/js/add.js +++ b/js/add.js @@ -166,17 +166,14 @@ function addAttributes(fields) { function validatePartName() { var partName = allowedChars.test($("#partNameInput").val()); - var ret; if (partName || !$("#partNameInput").val()) { $("#partNameInput").parent().removeClass("has-error"); - ret = 1; } else { $("#partNameInput").parent().addClass("has-error"); - ret = 0; } - return ret; + return partName && $("#partNameInput").val().length !== 0; } function validateDescription() { @@ -185,10 +182,10 @@ function validateDescription() { if (description || !$("#descriptionInput").val()) { $("#descriptionInput").parent().removeClass("has-error"); - return 1; + return true; } else { $("#descriptionInput").parent().addClass("has-error"); - return 0; + return false; } return ret; @@ -201,32 +198,26 @@ function validateCategory() { function validateDatasheet() { var datasheet = /^[^'"\\\s]+$/.test($("#datasheetInput").val()); - var ret; if (datasheet || !$("#datasheetInput").val()) { $("#datasheetInput").parent().removeClass("has-error"); - ret = 1; } else { $("#datasheetInput").parent().addClass("has-error"); - ret = 0; } - return ret; + return datasheet && $("#datasheetInput").val().length !== 0; } function validateLocation() { var location = allowedChars.test($("#locationInput").val()); - var ret; if (location || !$("#locationInput").val()) { $("#locationInput").parent().removeClass("has-error"); - ret = 1; } else { $("#locationInput").parent().addClass("has-error"); - ret = 0; } - return ret; + return location && $("#locationInput").val().length !== 0; } function validateEditDetails() { @@ -505,16 +496,20 @@ $(document).ready(function () { $('#locationInput').on("change keyup paste", function () { var location = allowedChars.test($("#locationInput").val()); - if (location) { + if (location && $("#locationInput").val()) { var query = {"location": $(this).val()}; $.post("/validate/location", query, function (result) { if (result == 1) { - $("#locationInput").parent().removeClass("has-error"); + $("#locationInput").parent().removeClass("has-warning"); $("#locationInput").parent().addClass("has-success"); } else { - $("#locationInput").parent().addClass("has-error"); + $("#locationInput").parent().addClass("has-warning"); + $("#locationInput").parent().removeClass("has-success"); } }); + } else { + $("#locationInput").parent().removeClass("has-warning"); + $("#locationInput").parent().removeClass("has-success"); } });