Move tooltip setup to the ui package

This commit is contained in:
Łukasz Mierzwa
2017-04-08 11:29:11 -07:00
parent 0a9ae793d5
commit 001006bfe0
3 changed files with 21 additions and 16 deletions

View File

@@ -21,20 +21,7 @@ var Alerts = (function() {
// called after group was rendered for the first time
Added() {
var groupID = '#' + this.id;
var group = $(groupID);
$.each(group.find('[data-toggle=tooltip]'), function(i, elem) {
$(elem).tooltip({
animation: false, // slows down tooltip removal
delay: {
show: 500,
hide: 0
},
title: $(elem).attr('title') || $(elem).data('ts-title'),
trigger: 'hover'
});
});
UI.SetupAlertGroupUI(group);
UI.SetupAlertGroupUI($('#' + this.id));
}
Update() {

View File

@@ -53,8 +53,26 @@ var UI = (function(params) {
}
// find all elements inside alert group panel that will use tooltips
// and setup those
setupGroupTooltips = function(groupElem) {
$.each(groupElem.find('[data-toggle=tooltip]'), function(i, elem) {
$(elem).tooltip({
animation: false, // slows down tooltip removal
delay: {
show: 500,
hide: 0
},
title: $(elem).attr('title') || $(elem).data('ts-title'),
trigger: 'hover'
});
});
}
setupAlertGroupUI = function(elem) {
setupGroupLinkHover(elem);
setupGroupTooltips(elem);
}

File diff suppressed because one or more lines are too long