Merge pull request #201 from supermamie/help_tooltip

[enh] add a template to display a clickable help
This commit is contained in:
Bram 2018-07-15 12:25:39 +02:00 committed by GitHub
commit 6292abaa03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(