fix jquery issues reported by idea

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-24 10:00:10 +00:00
parent d3926adc7d
commit b4f0e806cb
1 changed files with 11 additions and 8 deletions

View File

@ -41,12 +41,12 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
return; return;
} }
Sammy.log(message); Sammy.log(message);
return; /*return;
if (typeof window.console != 'undefined' && typeof window.console.log != 'undefined') { if (typeof window.console != 'undefined' && typeof window.console.log != 'undefined') {
console.log(message); console.log(message);
} else { } else {
// do nothing no console // do nothing no console
} }*/
}); });
/** /**
@ -113,8 +113,9 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
* clear #main-content and call clearUserMessages * clear #main-content and call clearUserMessages
*/ */
screenChange=function(){ screenChange=function(){
$("#main-content").html(""); var mainContent=$("#main-content");
$("#main-content").removeAttr("data-bind"); mainContent.html("");
mainContent.removeAttr("data-bind");
clearUserMessages(); clearUserMessages();
} }
@ -149,13 +150,14 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
* @param title * @param title
*/ */
openDialogConfirm=function(okFn, okMessage, cancelMessage, title,bodyText){ openDialogConfirm=function(okFn, okMessage, cancelMessage, title,bodyText){
var dialogCancel=$("#dialog-confirm-modal-cancel");
if (window.modalConfirmDialog==null) { if (window.modalConfirmDialog==null) {
window.modalConfirmDialog = $("#dialog-confirm-modal").modal();//{backdrop:'static',show:false} window.modalConfirmDialog = $("#dialog-confirm-modal").modal();//{backdrop:'static',show:false}
window.modalConfirmDialog.bind('hidden', function () { window.modalConfirmDialog.bind('hidden', function () {
$("#dialog-confirm-modal-header-title").html(""); $("#dialog-confirm-modal-header-title").html("");
$("#dialog-confirm-modal-body-text").html(""); $("#dialog-confirm-modal-body-text").html("");
}) })
$("#dialog-confirm-modal-cancel").on("click", function(){ dialogCancel.on("click", function(){
window.modalConfirmDialog.modal('hide'); window.modalConfirmDialog.modal('hide');
}); });
} }
@ -165,13 +167,14 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
$("#dialog-confirm-modal-ok").html(okMessage); $("#dialog-confirm-modal-ok").html(okMessage);
} }
if (cancelMessage){ if (cancelMessage){
$("#dialog-confirm-modal-cancel").html(cancelMessage); dialogCancel.html(cancelMessage);
} }
window.modalConfirmDialog.modal('show'); window.modalConfirmDialog.modal('show');
// unbind previous events !! // unbind previous events !!
$("#dialog-confirm-modal-ok").off( ); var dialogConfirmModalOk=$("#dialog-confirm-modal-ok");
$("#dialog-confirm-modal-ok").on("click", okFn); dialogConfirmModalOk.off( );
dialogConfirmModalOk.on("click", okFn);
} }