%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/widget/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/widget/confirm-dialog-min.js

define("widget/confirm-dialog",["jquery","underscore","util/ajax","widget/submit-spinner"],function(E,B,D,C){function A(G,F){this.dialogOptions=E.extend({},A.dialogDefaults,G);this.ajaxOptions=F||{};this._selectors=[];this._okCallbacks=E.Callbacks();this._cancelCallback=E.Callbacks();this._detachers=E.Callbacks();this._attached=false}A.prototype.getConfirmButton=function(){return E("#"+this.dialogOptions.id+" ."+this.dialogOptions.confirmButtonClass)};A.prototype.getButtons=function(){var G=this.getConfirmButton(),F=this.dialogOptions.id;B.each(this._selectors,function(H){G=G.add(E("#"+F+" "+H))});return G};A.prototype.setButtonsDisabled=function(F){this.getButtons().each(function(){var G=E(this);G.prop("disabled",F).toggleClass("disabled",F);if(F){G.attr("aria-disabled","true")}else{G.removeAttr("aria-disabled")}})};A.prototype.destroy=function(){this._detachers.fire();this._detachers=null};A.prototype.attachTo=function(F,M,G){var P=this,H=this.dialogOptions,J=this.ajaxOptions,K=this._okCallbacks,I=this._cancelCallback;G=G||document;var O=E(G);this._selectors.push(F);var N=function(){P.setButtonsDisabled(false)};O.on("hideLayer",N);var L=function(T){T.preventDefault();var R=E(this);if(!R.is(":disabled")){var Q=function(U){P.setButtonsDisabled(false);U.remove()},S=new AJS.Dialog({width:H.width,height:H.height,id:H.id,focusSelector:H.focusSelector,closeOnOutsideClick:false,keypressListener:function(U){U.stopImmediatePropagation();if(U.keyCode===E.ui.keyCode.ENTER){U.preventDefault();P.getConfirmButton().click()}else{if(U.keyCode===E.ui.keyCode.ESCAPE){U.preventDefault();Q(S)}}}});S.addHeader(H.titleText,H.titleClass);S.addPanel("",H.panelContent,H.panelClass);S.addButton(H.submitText,function(U){P.setButtonsDisabled(true);var W=null;var V=new C(P.getConfirmButton(),"before");if(P.dialogOptions.submitToHref){V.show();if(R[0].tagName==="A"){W=D.rest(E.extend({url:R.attr("href")},J)).always(function(){V.hide();Q(U)})}else{R.closest("form")[0].submit()}}K.fire(W,R,function(){Q(U)},U,V)},"button "+(H.confirmButtonClass||""));S.addCancel(AJS.I18n.getText("stash.web.button.cancel"),function(U){Q(U);I.fire(R)});if(M){M(this,S,P)}S.show();P._attached=true}};O.on("click",F,L);this._detachers.add(function(){O.off("hideLayer",N);O.off("click",F,L)})};A.prototype.addConfirmListener=function(F){this._okCallbacks.add(F)};A.prototype.addCancelListener=function(F){this._cancelCallback.add(F)};A.dialogDefaults={id:undefined,titleText:AJS.I18n.getText("stash.web.title.confirm"),titleClass:"confirm-header",confirmButtonClass:"confirm-button",panelContent:"<p>"+AJS.I18n.getText("stash.web.dialog.confirm")+"</p>",panelClass:"panel-body",submitText:AJS.I18n.getText("stash.web.button.confirm"),submitToHref:true,height:230,width:433,focusSelector:".confirm-button"};return A});

Zerion Mini Shell 1.0