From b69364d5ffb27fe98008fa6c5aa8f63e3c5645a8 Mon Sep 17 00:00:00 2001 From: MrM <11910225+mauro-miatello@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:47:06 +0100 Subject: [PATCH 1/2] Add copy of encrypted custom fields Encrypted custom fields may contain sensitive or important information, and it may be useful to have the ability to copy them. --- resources/views/hardware/view.blade.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 0e198e65a..72a260394 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -76,12 +76,12 @@ - +
  • - + @can('update', \App\Models\Asset::class)
  • @@ -138,7 +138,7 @@ - +
    @@ -238,11 +238,11 @@
    - {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} - @if ($audit_log->user) + {{ \App\Helpers\Helper::getFormattedDateObject($audit_log->created_at, 'date', false) }} + @if ($audit_log->user) (by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }}) - @endif - + @endif +
    @endif @@ -415,6 +415,7 @@ @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) @can('assets.view.encrypted_custom_fields') + @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
    {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} @elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!='')) @@ -422,7 +423,11 @@ @else {{ Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) }} @endif - @else + + + @else {{ strtoupper(trans('admin/custom_fields/general.encrypted')) }} @endcan @@ -520,7 +525,7 @@ @endif {{ Helper::formatCurrencyOutput($asset->getDepreciatedValue() )}} - +
    @endif From 9475871edb1e48d0613c8c509f8f0d0dcc988edc Mon Sep 17 00:00:00 2001 From: MrM <11910225+mauro-miatello@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:48:05 +0100 Subject: [PATCH 2/2] Fix multiple tooltip issue If there are multiple tooltips, they all report the message "copied" because there is no element selection. This fix resolves the issue. --- resources/views/layouts/default.blade.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index f355e73d6..95a82ce41 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -960,7 +960,13 @@ var clipboard = new ClipboardJS('.js-copy-link'); clipboard.on('success', function(e) { - $('.js-copy-link').tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show'); + // Get the clicked element + var clickedElement = $(e.trigger); + // Get the target element selector from data attribute + var targetSelector = clickedElement.data('data-clipboard-target'); + // Find the target element + var targetEl = $(targetSelector); + clickedElement.tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show'); }); // ignore: 'input[type=hidden]' is required here to validate the select2 lists