mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #201 from supermamie/help_tooltip
[enh] add a template to display a clickable help
This commit is contained in:
commit
6292abaa03
1 changed files with 32 additions and 0 deletions
|
@ -50,6 +50,38 @@
|
||||||
+ '</span>');
|
+ '</span>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('helpTooltip', function(text, url) {
|
||||||
|
var help = null;
|
||||||
|
var helpUrl = null;
|
||||||
|
if (text && text.string && text.string.trim() != "")
|
||||||
|
{
|
||||||
|
help = text.string;
|
||||||
|
}
|
||||||
|
if (url && url.string && url.string.trim() != "")
|
||||||
|
{
|
||||||
|
helpUrl = url.string;
|
||||||
|
}
|
||||||
|
if (help == null && helpUrl == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (helpUrl == null)
|
||||||
|
{
|
||||||
|
return new Handlebars.SafeString(
|
||||||
|
'<span data-toggle="tooltip" title="' + help + '" data-html="true" data-placement="right">'
|
||||||
|
+ ' <i class="fa-question-circle"></i>'
|
||||||
|
+ '</span>');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Handlebars.SafeString(
|
||||||
|
'<span data-toggle="tooltip" title="' + help + '" data-html="true" data-placement="right">'
|
||||||
|
+ ' <a href="' + helpUrl + '" class="fa-question-circle"></a>'
|
||||||
|
+ '</span>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Load tooltips on the page; needed if using tooltips
|
// Load tooltips on the page; needed if using tooltips
|
||||||
Handlebars.registerHelper('load_tooltips', function() {
|
Handlebars.registerHelper('load_tooltips', function() {
|
||||||
return new Handlebars.SafeString(
|
return new Handlebars.SafeString(
|
||||||
|
|
Loading…
Reference in a new issue