Skip to content

Commit

Permalink
Fix notification links (#18243)
Browse files Browse the repository at this point in the history
* fix not working notification copy link

Signed-off-by: faissaloux <fwahabali@gmail.com>

* fix not working notification links

Signed-off-by: faissaloux <fwahabali@gmail.com>

* fix notification links tooltip messages

Signed-off-by: faissaloux <fwahabali@gmail.com>

* update Edit Query message

Signed-off-by: faissaloux <fwahabali@gmail.com>

* remove unused event param

Signed-off-by: faissaloux <fwahabali@gmail.com>

* refactor

Signed-off-by: faissaloux <fwahabali@gmail.com>

* revert Edit Query message

Signed-off-by: faissaloux <fwahabali@gmail.com>

* refactor

Signed-off-by: faissaloux <fwahabali@gmail.com>

* code style

Signed-off-by: faissaloux <fwahabali@gmail.com>

* refactor

Signed-off-by: faissaloux <fwahabali@gmail.com>

---------

Signed-off-by: faissaloux <fwahabali@gmail.com>



Fixes #18241

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
faissaloux committed Apr 30, 2024
1 parent ba5533c commit de7a964
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js/src/functions.js
Expand Up @@ -2081,6 +2081,7 @@ $(function () {

$(document).on('click', 'a.copyQueryBtn', function (event) {
event.preventDefault();

var res = Functions.copyToClipboard($(this).attr('data-text'));
if (res) {
$(this).after('<span id=\'copyStatus\'> (' + Messages.strCopyQueryButtonSuccess + ')</span>');
Expand All @@ -2091,6 +2092,24 @@ $(function () {
$('#copyStatus').remove();
}, 2000);
});

$(document).on('mouseover mouseleave', '.ajax_notification a', function (event) {
let message = Messages.strDismiss;

if (event.type === 'mouseover') {
message = $(this).hasClass('copyQueryBtn') ? Messages.strCopyToClipboard : Messages.strEditQuery;
}

Functions.tooltip(
$('.ajax_notification'),
'span',
message
);
});

$(document).on('mouseup', '.ajax_notification a', function (event) {
event.stopPropagation();
});
});

/**
Expand Down
Expand Up @@ -385,6 +385,7 @@ private function setMessages(): void
'strHideQueryBox' => __('Hide query box'),
'strShowQueryBox' => __('Show query box'),
'strEdit' => __('Edit'),
'strEditQuery' => __('Edit query'),
'strDelete' => __('Delete'),
'strNotValidRowNumber' => __('%d is not valid row number.'),
'strBrowseForeignValues' => __('Browse foreign values'),
Expand Down Expand Up @@ -472,6 +473,7 @@ private function setMessages(): void

/* For table/change.js */
'strIgnore' => __('Ignore'),
'strCopyToClipboard' => __('Copy to clipboard'),
'strCopy' => __('Copy'),
'strX' => __('X'),
'strY' => __('Y'),
Expand Down

0 comments on commit de7a964

Please sign in to comment.