-
-
Save waerp/9a663aa0491ea08c9012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PrimeFaces.widget.Growl = PrimeFaces.widget.Growl.extend({ | |
renderMessage: function (msg) { | |
var growlId = msg.id; | |
var markup = '<div class="ui-growl-item-container ui-state-highlight ui-corner-all ui-helper-hidden ui-shadow" onclick="onGrowlDivClicked(\'' + growlId + '\')" style="cursor:pointer;">'; | |
markup += '<div class="ui-growl-item">'; | |
markup += '<div class="ui-growl-icon-close ui-icon ui-icon-closethick" style="display:none"></div>'; | |
markup += '<span class="ui-growl-image ui-growl-image-' + msg.severity + '" />'; | |
markup += '<div class="ui-growl-message">'; | |
markup += '<span class="ui-growl-title"></span>'; | |
markup += '<p></p>'; | |
markup += '</div><div style="clear: both;"></div></div></div>'; | |
var message = $(markup), | |
summaryEL = message.find('span.ui-growl-title'), | |
detailEL = summaryEL.next(); | |
if (this.cfg.escape) { | |
summaryEL.text(msg.summary); | |
detailEL.text(msg.detail); | |
} else { | |
summaryEL.html(msg.summary); | |
detailEL.html(msg.detail); | |
} | |
this.bindEvents(message); | |
message.appendTo(this.jq).fadeIn(); | |
} | |
}); | |
function onGrowlDivClicked(clientId) { | |
var clientId = PrimeFaces.escapeClientId(clientId); | |
if ($(clientId).is("div")) { | |
$('html, body').animate({ | |
scrollTop: $(clientId).offset().top | |
}, 2000); | |
} else { | |
$('html, body').animate({ | |
scrollTop: $(clientId).offset().top | |
}, 2000); | |
$(clientId).focus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment