Skip to content

Commit

Permalink
[CHANGE] Re-add tooltip to SRP payout value field
Browse files Browse the repository at this point in the history
  • Loading branch information
ppfeufer committed Mar 29, 2024
1 parent 4fc373b commit 7b2c51f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Section Order:

- Use Bootstrap 5 CSS and JS for Datatables in the SRP request view

### Changed

- Re-add tooltip to SRP payout value field in the SRP request view

## \[2.0.0\] - 2024-03-16

> \[!NOTE\]
Expand Down
30 changes: 23 additions & 7 deletions aasrp/static/aasrp/javascript/aa-srp-view-requests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global aaSrpSettings, moment */
/* global aaSrpSettings, bootstrap, moment */

$(document).ready(() => {
'use strict';
Expand Down Expand Up @@ -84,7 +84,7 @@ $(document).ready(() => {
*/
render: (data, type) => {
if (type === 'display') {
return `<span class="srp-payout-amount">${data.toLocaleString()} ISK</span>`;
return `<span class="srp-payout-tooltip"><span class="srp-payout-amount">${data.toLocaleString()} ISK</span></span>`;
} else {
return data;
}
Expand Down Expand Up @@ -175,20 +175,30 @@ $(document).ready(() => {
.find('td.srp-request-payout')
.addClass('srp-request-payout-amount-editable');

$(row)
.find('span.srp-payout-tooltip')
.attr(
'data-bs-tooltip',
'aa-srp-tooltip'
)
.attr(
'title',
aaSrpSettings.translation.changeSrpPayoutAmount
);

$(row)
.find('span.srp-payout-amount')
.addClass('srp-request-' + srpRequestCode)
.attr('data-pk', srpRequestCode)
.attr(
'data-params',
`{csrfmiddlewaretoken:'${aaSrpSettings.csrfToken}'}`
)
.attr('data-pk', srpRequestCode)
// .attr('data-bs-title', aaSrpSettings.translation.changeSrpPayoutAmount)
.attr('title', aaSrpSettings.translation.changeSrpPayoutAmount)
.attr(
'data-url',
aaSrpSettings.url.changeSrpAmount.replace(
'SRP_REQUEST_CODE', srpRequestCode
'SRP_REQUEST_CODE',
srpRequestCode
)
);
}
Expand Down Expand Up @@ -269,7 +279,13 @@ $(document).ready(() => {
});

// Show bootstrap tooltips
// $('[data-tooltip="enable"]').tooltip();
[].slice.call(
document.querySelectorAll(
'[data-bs-tooltip="aa-srp-tooltip"]'
)
).map((tooltipTriggerEl) => {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
});

/**
Expand Down
2 changes: 1 addition & 1 deletion aasrp/static/aasrp/javascript/aa-srp-view-requests.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7b2c51f

Please sign in to comment.