Add tooltip for Tab's header, it can be set as attribute 'hint' in openTab framework app object too

This commit is contained in:
Hadi Nategh 2020-09-25 11:53:00 +02:00
parent f88ae4f46a
commit 3956760c23
2 changed files with 13 additions and 1 deletions

View File

@ -492,7 +492,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
_app.tab = this.tabsUi.addTab(_app.icon, this.tabClickCallback, this.tabCloseClickCallback,
_app, _pos, _status);
_app.tab.setTitle(_app.displayName);
_app.tab.setHint(_app.hint ? _app.hint : '');
//Set the tab closeable if there's more than one tab
this.tabsUi.setCloseable(this.tabsUi._isNotTheLastTab());
// Do not show tab header if the app is with status 5, means run in background

View File

@ -308,6 +308,7 @@ function egw_fw_ui_tab(_parent, _contHeaderDiv, _contDiv, _icon, _callback,
this.position = _pos;
this.status = _status;
this.notification = 0;
this.hint = '';
//Create the header div and set its "click" function and "hover" event
this.headerDiv = document.createElement("span");
@ -439,6 +440,17 @@ egw_fw_ui_tab.prototype.setTitle = function(_title)
jQuery(this.headerH1).text(_title);
};
/**
* setHint sets tooltip of this tab. An existing tooltip will be removed.
*
* @param {string} _hint Text which should be displayed.
*/
egw_fw_ui_tab.prototype.setHint = function(_hint)
{
this.hint = _hint;
egw().tooltipBind(jQuery(this.headerDiv), _hint);
};
/**
* setTitle sets the content of this tab. Existing content is removed.
*