%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/util/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/util/config-form-min.js

define("util/config-form",["jquery","underscore","util/ajax"],function(D,G,F){function C(K,J){return G.isFunction(K)?K(G.extend({},J)):K}var H={};function A(N,M){var L={};M=G.extend({},M,N.params);if(N["context-provider"]){M=C(N["context-provider"],M)}var K;try{G.each(N,function(S,Q){if(!(/params|context-provider|view/.test(Q))){L[Q]=C(N[Q],M)}else{if(Q==="view"){var P=S(M);if(P){var R={};if(typeof P==="object"){R=G.extend(R,P)}if(P.loadTransformer){M.config=C(P.loadTransformer,M.config)}var O=G.isFunction(P.formContents)?P.formContents:P;R.formContents=C(O,M);L.view=R}}}})}catch(J){K=J}if(!L.view){L.view={formContents:aui.message.error({content:AJS.escapeHtml(AJS.I18n.getText("stash.config.form.load.error",L.pluginKey+":"+L.key,K?K:"Unknown error"))})}}L.moduleKey=L.key;L.completeModuleKey=L.pluginKey+":"+L.key;H[L.completeModuleKey]=L;return L}function B(J){return H[J.pluginKey+":"+J.key]}function E(K){var J=WebFragments.getWebFragmentDescriptors(K,"panel");if(J&&J.length){return J[0]}else{return null}}function I(K,J){this.$container=D(K);this.configContextName=J}I.prototype.loadAndRender=function(J){return D.when(J(),this._loadWebResources().fail(G.bind(function(K){this.$container.html(aui.message.error({content:K.message}))},this))).done(G.bind(function(K){this._render(K[0])},this))};I.prototype._loadWebResources=function(){return WRM.require("wrc!"+this.configContextName)};I.prototype._render=function(M,J,N){var L={config:M||{},errors:J};var O=E(this.configContextName);var K=A(O,L);this.$container.empty();if(K&&K.view&&K.view.formContents){this.$container.append(widget.aui.form.form({content:K.view.formContents,action:"",errors:N}));this.$container.find(":input:visible:enabled:first").first().focus()}if(K&&K.view&&K.view.initForm){K.view.initForm(M)}};I.prototype.save=function(L){var K=F.formToJSON(this.$container.find("form.aui"));var M=E(this.configContextName);var J=B(M);if(J&&J.view&&J.view.saveTransformer){K=J.view.saveTransformer(K)}return D.when(L(K)).fail(G.bind(this._validationErrors,this,K))};I.prototype._validationErrors=function(K,M,O,L,J){var N=G.reduce(J.errors,function(P,Q){P[Q.context]=(P[Q.context]||[]).concat([Q.message]);return P},{});this._render(K,N,N[null])};return I});ConfigForm=require("util/config-form");

Zerion Mini Shell 1.0