From 1fb04c97a141dfd46b891eea037a0c34c176c037 Mon Sep 17 00:00:00 2001 From: John Clary Date: Tue, 21 Dec 2021 15:57:55 -0600 Subject: [PATCH 1/3] update text when rendering link to cabinet details --- code/data-tracker/data-tracker.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/data-tracker/data-tracker.js b/code/data-tracker/data-tracker.js index 82864a79..4b651281 100644 --- a/code/data-tracker/data-tracker.js +++ b/code/data-tracker/data-tracker.js @@ -873,3 +873,14 @@ $(document).on("knack-view-render.view_1252", function (event, page) { //////////////////////////////////////////// /// End Technician Time Log Validation /// //////////////////////////////////////////// + +//// Update link text to cabinet details page from signal detals +$(document).on("knack-view-render.view_1261", function (event, page) { + console.log("hello") + // find cabinet ID field div + var el = $(".field_1789"); + // find child + var a = $(el).find("a"); + // update text + $(a).text("Cabinet details"); +}); From 3432d6de2fbd545814309ca864e69b1bde605db3 Mon Sep 17 00:00:00 2001 From: John Clary Date: Tue, 21 Dec 2021 15:58:40 -0600 Subject: [PATCH 2/3] linting --- code/data-tracker/data-tracker.js | 93 ++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 27 deletions(-) diff --git a/code/data-tracker/data-tracker.js b/code/data-tracker/data-tracker.js index 4b651281..bf5ecc3a 100644 --- a/code/data-tracker/data-tracker.js +++ b/code/data-tracker/data-tracker.js @@ -11,12 +11,18 @@ function customizeLoginButton(viewId) { // Create a div for Login buttons var $coacdButton = $("
", { - id: "coacd-button-login" + id: "coacd-button-login", }); $coacdButton.appendTo("#" + viewId); // Append Big SSO Login button and non-SSO Login button - bigButton("coacd-big-button", "coacd-button-login", url, "sign-in", "Sign-In") + bigButton( + "coacd-big-button", + "coacd-button-login", + url, + "sign-in", + "Sign-In" + ); $coacdButton.append( "" + @@ -53,10 +59,29 @@ $(document).on("knack-view-render.any", function (event, page) { /*************** Big Buttons ****************/ /********************************************/ //Create Big Button nested in a block -function bigButton(id, view_id, url, fa_icon, button_label, is_disabled = false, callback = null) { +function bigButton( + id, + view_id, + url, + fa_icon, + button_label, + is_disabled = false, + callback = null +) { var disabledClass = is_disabled ? " big-button-disabled'" : "'"; - $( " " + button_label + "" ).appendTo("#" + view_id); + $( + " " + + button_label + + "" + ).appendTo("#" + view_id); if (callback) callback(); } @@ -65,10 +90,29 @@ function bigButton(id, view_id, url, fa_icon, button_label, is_disabled = false, /************** Small Buttons ***************/ /********************************************/ //Create Small Button nested in a block -function smallButton(id, view_id, url, fa_icon, button_label, is_disabled = false, callback = null) { +function smallButton( + id, + view_id, + url, + fa_icon, + button_label, + is_disabled = false, + callback = null +) { var disabledClass = is_disabled ? " small-button-disabled'" : "'"; - $( " " + button_label + "" ).appendTo("#" + view_id); + $( + " " + + button_label + + "" + ).appendTo("#" + view_id); if (callback) callback(); } @@ -568,7 +612,10 @@ $(document).on("knack-scene-render.scene_1171", function (event, page) { $("#" + detailsView) .find("div.kn-detail." + fields.quantity.current) .find(".kn-detail-body span")[0] - ).text().replaceAll(",", "").trim() + ) + .text() + .replaceAll(",", "") + .trim() ); // handle situation where stock levels are negative (this should not but prob will happen) @@ -746,7 +793,6 @@ $(document).on("knack-scene-render.scene_634", function (event, scene) { /// Begin Technician Time Log Validation /// //////////////////////////////////////////// - function appendErrorMessage(viewKey, formDiv, msg) { // remove existing error msg if present var errorDiv = $( @@ -852,19 +898,12 @@ $(document).on("knack-view-render.view_1252", function (event, page) { highlightErrorField(`#${viewKey}-${startField.key}`); highlightErrorField(`#${viewKey}-${endField.key}`); - errorMsgs = `${errorMsgs}${formatErrorMessage( - startField, - endField - )}`; + errorMsgs = `${errorMsgs}${formatErrorMessage(startField, endField)}`; } } if (!passesValidation) { - // show red error banner - appendErrorMessage( - viewKey, - formDiv, - errorMsgs - ); + // show red error banner + appendErrorMessage(viewKey, formDiv, errorMsgs); } return passesValidation; }); @@ -876,11 +915,11 @@ $(document).on("knack-view-render.view_1252", function (event, page) { //// Update link text to cabinet details page from signal detals $(document).on("knack-view-render.view_1261", function (event, page) { - console.log("hello") - // find cabinet ID field div - var el = $(".field_1789"); - // find child - var a = $(el).find("a"); - // update text - $(a).text("Cabinet details"); + console.log("hello"); + // find cabinet ID field div + var el = $(".field_1789"); + // find child + var a = $(el).find("a"); + // update text + $(a).text("Cabinet details"); }); From 3174e76494405dcbed65c6a674969e0742befcf0 Mon Sep 17 00:00:00 2001 From: John Clary Date: Tue, 21 Dec 2021 16:07:46 -0600 Subject: [PATCH 3/3] Make link a button --- code/data-tracker/data-tracker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/data-tracker/data-tracker.js b/code/data-tracker/data-tracker.js index bf5ecc3a..58e14d32 100644 --- a/code/data-tracker/data-tracker.js +++ b/code/data-tracker/data-tracker.js @@ -915,11 +915,13 @@ $(document).on("knack-view-render.view_1252", function (event, page) { //// Update link text to cabinet details page from signal detals $(document).on("knack-view-render.view_1261", function (event, page) { - console.log("hello"); // find cabinet ID field div var el = $(".field_1789"); // find child var a = $(el).find("a"); // update text - $(a).text("Cabinet details"); + $(a).addClass("kn-link kn-link-1 kn-link-page kn-button"); + $(a).html( + "Cabinet details" + ); });