mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-04 05:39:51 +01:00
fix: dynamic tooltips
This commit is contained in:
@@ -10,7 +10,8 @@ define('forum/topic/threadTools', [
|
||||
'hooks',
|
||||
'bootbox',
|
||||
'alerts',
|
||||
], function (components, translator, handleBack, posts, api, hooks, bootbox, alerts) {
|
||||
'bootstrap',
|
||||
], function (components, translator, handleBack, posts, api, hooks, bootbox, alerts, bootstrap) {
|
||||
const ThreadTools = {};
|
||||
|
||||
ThreadTools.init = function (tid, topicContainer) {
|
||||
@@ -365,11 +366,12 @@ define('forum/topic/threadTools', [
|
||||
unfollow: '[[topic:not-watching]]',
|
||||
ignore: '[[topic:ignoring]]',
|
||||
};
|
||||
// TODO: doesnt work on bs5
|
||||
|
||||
translator.translate(titles[state], function (translatedTitle) {
|
||||
$('[component="topic/watch"]')
|
||||
.attr('title', translatedTitle)
|
||||
.tooltip();
|
||||
const tooltip = bootstrap.Tooltip.getInstance('[component="topic/watch"]');
|
||||
if (tooltip) {
|
||||
tooltip.setContent({ '.tooltip-inner': translatedTitle });
|
||||
}
|
||||
});
|
||||
|
||||
let menu = components.get('topic/following/menu');
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
define('forum/topic/votes', [
|
||||
'components', 'translator', 'api', 'hooks', 'bootbox', 'alerts',
|
||||
], function (components, translator, api, hooks, bootbox, alerts) {
|
||||
'components', 'translator', 'api', 'hooks', 'bootbox', 'alerts', 'bootstrap',
|
||||
], function (components, translator, api, hooks, bootbox, alerts, bootstrap) {
|
||||
const Votes = {};
|
||||
|
||||
Votes.addVoteHandler = function () {
|
||||
@@ -32,7 +32,13 @@ define('forum/topic/votes', [
|
||||
|
||||
function createTooltip(el, data) {
|
||||
function doCreateTooltip(title) {
|
||||
el.attr('title', title).tooltip('fixTitle').tooltip('show');
|
||||
const tooltip = bootstrap.Tooltip.getInstance(el);
|
||||
if (tooltip) {
|
||||
tooltip.setContent({ '.tooltip-inner': title });
|
||||
} else {
|
||||
el.attr('title', title);
|
||||
(new bootstrap.Tooltip(el)).show();
|
||||
}
|
||||
el.parent().find('.tooltip').css('display', '');
|
||||
}
|
||||
let usernames = data.usernames
|
||||
|
||||
Reference in New Issue
Block a user