From 4681fa1e65ece19a8ef68e5b32b2dabddb9fb252 Mon Sep 17 00:00:00 2001 From: Joe Uhren Date: Wed, 6 Jul 2022 21:10:01 -0600 Subject: [PATCH] Network addnode table updates -Added "copy to clipboard" buttons to addnode tables -Addnode table data no longer wraps onto multiple lines when the data cannot fit on the screen --- public/css/style.scss | 29 +++++++++++++++++++++++++++++ views/network.pug | 26 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/public/css/style.scss b/public/css/style.scss index 67e88d5..7f6df1b 100644 --- a/public/css/style.scss +++ b/public/css/style.scss @@ -1092,4 +1092,33 @@ tr { #showClaimInstructions:hover { color: #efefef; +} + +.btn-copy { + padding: 0.1rem 0.3rem; + font-size: 0.85em; + color: #24292f; + background-color: #f6f8fa; + border: 1px solid #ccced1; + border-radius: .25rem; + line-height: normal; + + &:hover { + background-color: #ebecf0; + color: #24292f; + border: 1px solid #ccced1; + } + + &:active, &:active:focus, &:focus { + border: 1px solid #ccced1; + } + + &.btn:not(.disabled):hover { + margin-top: 0; + border: 1px solid #ccced1; + } + + > i { + width: 12px; + } } \ No newline at end of file diff --git a/views/network.pug b/views/network.pug index f3dd6b0..6b4cd17 100644 --- a/views/network.pug +++ b/views/network.pug @@ -118,6 +118,9 @@ block content } }, data: addNodeRows, + rowCallback: function(row, data, index) { + $("td:eq(0)", row).css('white-space', 'nowrap').html(` ${data.nodes}`); + }, fnDrawCallback: function(settings) { fixDataTableColumns(); fixFooterHeightAndPosition(); @@ -166,6 +169,9 @@ block content } }, data: oneTryRows, + rowCallback: function(row, data, index) { + $("td:eq(0)", row).css('white-space', 'nowrap').html(` ${data.nodes}`); + }, fnDrawCallback: function(settings) { fixDataTableColumns(); fixFooterHeightAndPosition(); @@ -199,6 +205,26 @@ block content } if (#{settings.shared_pages.page_header.page_title_image.enable_animation} == true && #{settings.network_page.page_header.show_img} == true) startRotateElement('img#header-img'); + + $('#addnodes').on('click', 'button.btn-copy', function (event) { + var btn = $(this); + + if (btn.html().indexOf('fa-copy') > -1) { + var tmp = $(''); + $('body').append(tmp); + tmp.val(btn.parent().find('span').html()).select(); + document.execCommand('copy'); + tmp.remove(); + + btn.tooltip({title: 'Copied!', placement: 'top', trigger: 'manual'}).tooltip('show'); + btn.html(''); + + setTimeout(function() { + btn.html(''); + btn.tooltip('dispose'); + }, 1500); + } + }); }); - var theadClasses = []; if settings.shared_pages.table_header_bgcolor != null && settings.shared_pages.table_header_bgcolor != ''