Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Data Tracker JS and CSS from production app #106

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 83 additions & 83 deletions code/data-tracker/data-tracker.css
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
/* Mobile Styles */
@media (max-width: 800px) {
/* Make buttons with type="submit" bigger */
button[type="submit"] {
height: 64px !important;
font-size: 32px !important;
min-width: fit-content;
width: 100%;
}
/* Override width set for submit buttons to prevent overlaying map controls */
#lat-lon-form > form > div > button {
width: 50%;
}
/* Increase font size of form field labels */
.kn-label {
font-size: 22px;
}
/* Increase height of text fields */
input[type="text"] {
height: 48px !important;
font-size: 22px !important;
}
/* Increase height of select fields */
.chzn-single {
height: 48px !important;
}
.kn-select {
height: 48px !important;
}
select {
height: 48px !important;
font-size: 22px !important;
}
/* Increase height of container surrounding select fields */
.chzn-container {
height: 48px;
font-size: 22px !important;
}
.chzn-container > a > span {
font-size: 22px !important;
}
/* Increase font size of dropdown text in select fields */
.chzn-drop {
font-size: 22px !important;
}
/* Increase size of search button */
.kn-button.search {
height: 48px;
}
/* Increase font size of checkbox options */
.option.checkbox {
font-size: 22px;
}
/* Make buttons with type="submit" bigger */
button[type="submit"] {
height: 64px !important;
font-size: 32px !important;
min-width: fit-content;
width: 100%;
}

/* Override width set for submit buttons to prevent overlaying map controls */
#lat-lon-form > form > div > button {
width: 50%;
}

/* Increase font size of form field labels */
.kn-label {
font-size: 22px;
}

/* Increase height of text fields */
input[type="text"] {
height: 48px !important;
font-size: 22px !important;
}

/* Increase height of select fields */
.chzn-single {
height: 48px !important;
}

.kn-select {
height: 48px !important;
}

select {
height: 48px !important;
font-size: 22px !important;
}

/* Increase height of container surrounding select fields */
.chzn-container {
height: 48px;
font-size: 22px !important;
}

.chzn-container > a > span {
font-size: 22px !important;
}

/* Increase font size of dropdown text in select fields */
.chzn-drop {
font-size: 22px !important;
}

/* Increase size of search button */
.kn-button.search {
height: 48px;
}

/* Increase font size of checkbox options */
.option.checkbox {
font-size: 22px;
}
}

.kn-link-disabled span {
color: #bdbebf !important;
}

.hidden {
display: none;
}
Expand All @@ -91,19 +91,19 @@ div.view_2491 .field_3174 { display: none; }
div.view_2465 .field_3174 { display: none; }

.big-button-container {
border-radius: 2px;
box-shadow: 0px 1px 2px 0px gray;
font-size: 2.5em;
padding: 10px;
margin: 20px;
max-width: 15em;
border-radius: 2px;
box-shadow: 0px 1px 2px 0px gray;
font-size: 2.5em;
padding: 10px;
margin: 20px;
max-width: 15em;
}

.big-button-container:hover {
background-color: #f7f7f7;
cursor: pointer;
background-color: #f7f7f7;
cursor: pointer;
}

.small-button-container {
padding: 5px;
margin: 20px;
Expand All @@ -116,25 +116,25 @@ div.view_2465 .field_3174 { display: none; }
}

.small-button-container:hover {
background-color: #4c4c4c;
cursor: pointer;
background-color: #4c4c4c;
cursor: pointer;
}

.fa {
vertical-align: middle;
}

a.big-button {
text-decoration: none;
}
a.small-button {

a.small-button {
text-decoration: none;
}


.hiddenFormField {
visibility: hidden;
height: 0px;
margin-bottom: 0 !important;
visibility: hidden;
height: 0px;
margin-bottom: 0 !important;
}
92 changes: 72 additions & 20 deletions code/data-tracker/data-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ function customizeLoginButton(viewId) {

// Create a div for Login buttons
var $coacdButton = $("<div/>", {
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(
"<a class='small-button' href='javascript:void(0)'>" +
Expand Down Expand Up @@ -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'" : "'";
$( "<a id='" + id + "' class='big-button-container" + disabledClass + " href='" + url +
"'><span><i class='fa fa-" + fa_icon + "'></i></span><span> " + button_label + "</span></a>" ).appendTo("#" + view_id);
$(
"<a id='" +
id +
"' class='big-button-container" +
disabledClass +
" href='" +
url +
"'><span><i class='fa fa-" +
fa_icon +
"'></i></span><span> " +
button_label +
"</span></a>"
).appendTo("#" + view_id);

if (callback) callback();
}
Expand All @@ -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'" : "'";
$( "<a id='" + id + "' class='back-button" + disabledClass + " href='" + url +
"'><span><i class='fa fa-" + fa_icon + "'></i></span><span> " + button_label + "</span></a>" ).appendTo("#" + view_id);
$(
"<a id='" +
id +
"' class='back-button" +
disabledClass +
" href='" +
url +
"'><span><i class='fa fa-" +
fa_icon +
"'></i></span><span> " +
button_label +
"</span></a>"
).appendTo("#" + view_id);

if (callback) callback();
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = $(
Expand Down Expand Up @@ -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;
});
Expand All @@ -873,3 +912,16 @@ $(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) {
// find cabinet ID field div
var el = $(".field_1789");
// find child <a>
var a = $(el).find("a");
// update text
$(a).addClass("kn-link kn-link-1 kn-link-page kn-button");
$(a).html(
"<span class='icon is-small'><i class='fa fa-list'></i></span><span>Cabinet details</span>"
);
});
Comment on lines +916 to +927
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't in here yet.