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

[Traffic Register] View PDF Buttons CSS Styling & JQuery Functionality #187

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
47 changes: 37 additions & 10 deletions code/traffic-register/traffic-register.css
Original file line number Diff line number Diff line change
Expand Up @@ -454,25 +454,52 @@ a.ang-link:link {text-decoration: none;}
/**************************************/
/*** Style Details Links as Buttons ***/
/**************************************/
/*These are for View PDF Buttons*/
/*Reg Doc Details Header navigating from Document Search*/
#kn-scene_588 #view_1476 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
/* These are for View PDF Buttons */
/*Reg Doc Details Header navigating from Document Search - Generated Power BI PDF*/
/* #kn-scene_588 #view_1476 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_588 #view_1476 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_588 #view_1476 .kn-detail-label { background-color: transparent; min-width: 0% !important; }
#kn-scene_588 #view_1476 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; }
#kn-scene_588 #view_1476 .kn-detail-label { background-color: transparent; min-width: 0% !important; } */

/*Reg Doc Details Header navigating from Regulations Search*/
#kn-scene_773 #view_1592 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
/*Reg Doc Details Header navigating from Document Search - Historical SharePoint PDF*/
/* #kn-scene_588 #view_1706 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #163f6e; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_773 #view_1592 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_773 #view_1592 .kn-detail-label { background-color: transparent; min-width: 0% !important; }
#kn-scene_588 #view_1706 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #163f6e; border-width: 2px; }
#kn-scene_588 #view_1706 .kn-detail-label { background-color: transparent; min-width: 0% !important; } */

/*Reg Doc Details Header navigating from Regulations Search - Generated Power BI PDF*/
/* #kn-scene_773 #view_1592 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_773 #view_1592 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; }
#kn-scene_773 #view_1592 .kn-detail-label { background-color: transparent; min-width: 0% !important; } */

/*Reg Doc Details Header navigating from Regulations Search - Historical SharePoint PDF*/
/* #kn-scene_773 #view_1705 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #163f6e; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_773 #view_1705 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #163f6e; border-width: 2px; }
#kn-scene_773 #view_1705 .kn-detail-label { background-color: transparent; min-width: 0% !important; } */

Copy link
Member Author

Choose a reason for hiding this comment

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

Previous 4 code blocks above have been commented out with the 2 new code blocks under the 'Style PDF Link Fields as Buttons' section

/*Draft Review Details Header*/
#kn-scene_673 #view_1478 div.kn-detail { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_673 #view_1478 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; min-width: 190px !important; max-width: 27% !important; }
#kn-scene_673 #view_1478 div.kn-detail:hover { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; }
#kn-scene_673 #view_1478 .kn-detail-label { background-color: transparent; min-width: 0% !important; }

/****************************************/
/*** Style PDF Link Fields as Buttons ***/
/****************************************/
div.kn-detail.field_1729 { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #dd4d4d; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
div.kn-detail:hover.field_1729 { opacity: 0.9; cursor: pointer; border-color: #dd4d4d; border-width: 2px; }
div.kn-detail.field_1729 .kn-detail-label { background-color: transparent; min-width: 0% !important; }
.pbi-link {text-decoration: none !important;} /*the CSS Class we apply to the anchor with JQuery. Overrides default .kn-content a*/

div.kn-detail.field_1778 { padding: 1px 2px; border-style: solid; border-width: 1px; border-color: #163f6e; border-radius: 8px;
box-shadow: 0px 0px 0px 0px gray; font-size: 1.25em; background-color: #ebebeb; color: #163f6e; text-align: left; min-width: 190px !important; max-width: 27% !important; }
div.kn-detail:hover.field_1778 { opacity: 0.9; cursor: pointer; border-color: #163f6e; border-width: 2px; }
div.kn-detail.field_1778 .kn-detail-label { background-color: transparent; min-width: 0% !important; }
.sp-link {text-decoration: none !important;} /*the CSS Class we apply to the anchor with JQuery. Overrides default .kn-content a*/

/*****************************************/
/** Remove Back Links for Draft Builder **/
/*****************************************/
Expand Down
21 changes: 21 additions & 0 deletions code/traffic-register/traffic-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,24 @@ $(document).on('knack-scene-render.scene_707', function(event, scene) {
$(document).on('knack-scene-render.scene_708', function(event, scene) {
$('#kn-app-menu').hide()
});

/*********************************************/
/************** PDF Button link **************/
/*********************************************/
$(document).on('knack-scene-render.any', function(event, scene) {
$(".kn-detail.field_1729 a").addClass("pbi-link"); /*Add CSS Class pbi-link to child anchor*/
$(".kn-detail.field_1729").wrap("<div class='pbi-link-button'></div>"); /*Wrap the div with div class pbi-link-button*/
$(".pbi-link-button").click(function(){ /*Add click event to the new div*/
window.open($(this).find("a").attr("href"), '_blank'); /*Click event uses link from child anchor & opens in new tab*/
return false;
});
});

$(document).on('knack-scene-render.any', function(event, scene) {
$(".kn-detail.field_1778 a").addClass("sp-link"); /*Add CSS Class sp-link to child anchor*/
$(".kn-detail.field_1778").wrap("<div class='sp-link-button'></div>"); /*Wrap the div with div class sp-link-button*/
$(".sp-link-button").click(function(){ /*Add click event to the new div*/
window.open($(this).find("a").attr("href"), '_blank'); /*Click event uses link from child anchor & opens in new tab*/
return false;
});
});