app/assets/javascripts/workarea/admin/modules/tooltips.js in workarea-admin-3.5.0.beta.1 vs app/assets/javascripts/workarea/admin/modules/tooltips.js in workarea-admin-3.5.0

- old
+ new

@@ -53,16 +53,31 @@ // If the options contains a content_id selector use that // Otherwise If the trigger is a link with href use that to populate tooltip // If neither are present, throw an error. getContent = function(trigger, options) { + var $content; + if (!_.isEmpty(options.content)) { - return options.content; + $content = $('<div />').html(options.content); } else if (!_.isEmpty(options.content_id)) { - return $(options.content_id); + $content = $(options.content_id); } else if(!_.isEmpty($(trigger).attr('href'))) { - return $($(trigger).attr('href')); + $content = $($(trigger).attr('href')); + } else { + $content = $('<div />'); } + + // Prevent interactive UIs within a tooltip from accidentally + // closing the tooltip. A good example of this would be jQuery UI + // Datepicker or Datetimepicker being embedded in a tooltip. + if (options.interactive && options.trigger === 'click') { + $content.on('click', function (event) { + event.stopPropagation(); + }); + } + + return $content; }, customTriggerToggle = function ($trigger) { var state = tooltipState($trigger);