rice-framework/krad-web/src/main/webapp/krad/scripts/krad.actions.js
/**
 *  Open a hidden section in a bootstrap popover and freeze it until the user
 *  clicks outside of the popup, or on the optional close button.
 *
 * @param popupTarget jQuery object representing the target
 * @param contentId id of hidden section with content (required)
 * @param popoverOptions map of popover options (optional)
 * @param closeButton when true, a small close button is rendered in the top-right corner of the popup (optional)
 **/
Open a hidden section in a bootstrap popover and freeze it until the user
clicks outside of the popup, or on the optional close button.

@param popupTarget jQuery object representing the target
@param contentId id of hidden section with content (required)
@param popoverOptions map of popover options (optional)
@param closeButton when true, a small close button is rendered in the top-right corner of the popup (optional)
Open a hidden section in a bootstrap popover and freeze it until the user clicks outside of the popup or on the optional close button . @param popupTarget jQuery object representing the target @param contentId id of hidden section with content ( required ) @param popoverOptions map of popover options ( optional ) @param closeButton when true a small close button is rendered in the top - right corner of the popup ( optional )
function _openPopover(popupTarget, contentId, popoverOptions, useCloseButton) {
    var popoverData = jQuery(popupTarget).data(kradVariables.POPOVER_DATA);
    var popupContent = jQuery("#" + contentId);
    if (popoverData && popoverData.shown) {
        _hidePopover(popupTarget);
        return;
    }
    hideTooltips();
    var clickName = "click." + popupTarget.attr('id');
    popupTarget.attr("data-popupContentId", popupContent.attr("id"));
    popupContent.attr("tabindex", "-1");
    popupContent.after("<div id='" + contentId + "_popupPlaceholder' style='display:none'></div>");
    popupContent = popupContent.detach().show();
    popupContent.addClass("uif-popupContent-inner");
    if (!popoverData) {
        if (popoverOptions && !popoverOptions.placement) {
            popoverOptions.placement = "auto bottom";
        }
        else if (!popoverOptions) {
            popoverOptions = {placement: "auto bottom"};
        }
        popoverData = initializeTooltip(popupTarget, popoverOptions, "uif-popupContent");
        if (useCloseButton && popupContent.find("> .close").length === 0) {
            var closeButton = jQuery('<button type="button" class="close">'
                    + '<span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>');
            closeButton.on(clickName, function () {
                _hidePopover(popupTarget);
            });
            popupContent.prepend(closeButton);
        }
    }
    popoverData.options.content = popupContent;
    popupTarget.popover("show");
    popoverData.shown = true;
    popupContent.focus();
    jQuery(document).on(clickName, function (e) {
        var docTarget = jQuery((e.target) ? e.target : e.srcElement);
        if (docTarget.parents("div.popover").length === 0) {
            _hidePopover(popupTarget);
        }
    });
    function _hidePopover(target) {
        var popoverData = jQuery(target).data(kradVariables.POPOVER_DATA);
        popoverData.shown = false;
        jQuery("#" + contentId + "_popupPlaceholder").replaceWith(popupContent.hide());
        target.popover("hide");
        jQuery(document).off("click." + target.attr('id'));
        target.focus();
    }
}
function _openPopover ( popupTarget , contentId , popoverOptions , useCloseButton ) { var popoverData = jQuery ( popupTarget ) . data ( kradVariables . POPOVER_DATA ) ; var popupContent = jQuery ( "#" + contentId ) ; if ( popoverData && popoverData . shown ) { _hidePopover ( popupTarget ) ; return ; } hideTooltips ( ) ; var clickName = "click." + popupTarget . attr ( 'id' ) ; popupTarget . attr ( "data-popupContentId" , popupContent . attr ( "id" ) ) ; popupContent . attr ( "tabindex" , "-1" ) ; popupContent . after ( "<div id='" + contentId + "_popupPlaceholder' style='display:none'></div>" ) ; popupContent = popupContent . detach ( ) . show ( ) ; popupContent . addClass ( "uif-popupContent-inner" ) ; if ( ! popoverData ) { if ( popoverOptions && ! popoverOptions . placement ) { popoverOptions . placement = "auto bottom" ; } else if ( ! popoverOptions ) { popoverOptions = { placement : "auto bottom" } ; } popoverData = initializeTooltip ( popupTarget , popoverOptions , "uif-popupContent" ) ; if ( useCloseButton && popupContent . find ( "> .close" ) . length === 0 ) { var closeButton = jQuery ( '<button type="button" class="close">' + '<span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>' ) ; closeButton . on ( clickName , function ( ) { _hidePopover ( popupTarget ) ; } ) ; popupContent . prepend ( closeButton ) ; } } popoverData . options . content = popupContent ; popupTarget . popover ( "show" ) ; popoverData . shown = true ; popupContent . focus ( ) ; jQuery ( document ) . on ( clickName , function ( e ) { var docTarget = jQuery ( ( e . target ) ? e . target : e . srcElement ) ; if ( docTarget . parents ( "div.popover" ) . length === 0 ) { _hidePopover ( popupTarget ) ; } } ) ; function _hidePopover ( target ) { var popoverData = jQuery ( target ) . data ( kradVariables . POPOVER_DATA ) ; popoverData . shown = false ; jQuery ( "#" + contentId + "_popupPlaceholder" ) . replaceWith ( popupContent . hide ( ) ) ; target . popover ( "hide" ) ; jQuery ( document ) . off ( "click." + target . attr ( 'id' ) ) ; target . focus ( ) ; } }
Open a hidden section in a bootstrap popover and freeze it until the user
  clicks outside of the popup, or on the optional close button.
Open a hidden section in a bootstrap popover and freeze it until the user clicks outside of the popup or on the optional close button .
// Make focusable by focus jquery call
 // add required class uif-tooltip to action and create popup
 // close popup on any click outside current popup
