From 81384baec44f1a100ff84434a511bc7df93d975e Mon Sep 17 00:00:00 2001 From: Michael Heppler Date: Thu, 15 Oct 2020 12:56:42 -0400 Subject: [PATCH] Added checksum truncation function WIP [ref #7081 #6685 #5210] --- src/main/webapp/file-info-fragment.xhtml | 5 ++- .../resources/js/dv_rebind_bootstrap_ui.js | 39 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/main/webapp/file-info-fragment.xhtml b/src/main/webapp/file-info-fragment.xhtml index 64e5da35368..c14c8f98b60 100644 --- a/src/main/webapp/file-info-fragment.xhtml +++ b/src/main/webapp/file-info-fragment.xhtml @@ -53,7 +53,10 @@
- + #{fileMetadata.dataFile.checksumType}: #{fileMetadata.dataFile.checksumValue} +
diff --git a/src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js b/src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js index 15c14e7d8bd..31b49d5827a 100644 --- a/src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js +++ b/src/main/webapp/resources/js/dv_rebind_bootstrap_ui.js @@ -29,6 +29,45 @@ function bind_bsui_components(){ // Disabled pagination links disabledLinks(); + // Truncate checksums + // TO-DO DETERMINE IF THIS IS PLACE IS OVERKILL, ON EVERY PG, EVERY REBIND ACTION ... + // PROBABLY NEEDED LIKE ALL THE OTHER FUNCTIONS FOR DYNAMIC AJAX UPDATES ON PG + checksumTruncate(); + + /* + * Truncate file checksums + */ + function checksumTruncate(){ + + // TO-DO MOVE THIS CHUNK OUT OF BIND_BSUI, TO BOTTOM OF THIS FILE + + $('span.checksum-truncate').each(function () { + + var checksumText = $(this).text(); + + console.log("Total Checksums..." + checksumText); + + $(this).css('color', 'red'); + + console.log("Characters..." + checksumText.length); + + if (checksumText.length > 35) { + $(this).text( checksumText.substr(0, 8) + '...' + checksumText.substr(checksumText.length-3, checksumText.length) ); + } + + // TO-DO WIRE UP CLICK TO COPY W/ CLIPBOARD.JS ... SEE JIM'S PR 5211 + // var clipboard = new Clipboard('button.checksum'); + // clipboard.on('success', function(e) { + // console.log(e); + // }); + // clipboard.on('error', function(e) { + // console.log(e); + // }); + + }); + + } + // Sharrre sharrre();