%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/feature/watch/
Upload File :
Create Path :
Current File : //data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/feature/watch/watch-min.js

define("feature/watch",["aui","jquery","lodash","util/ajax","model/page-state"],function(A,G,C,F,E){var D={COMMIT:"commit",PULL_REQUEST:"pull-request"};function B(H,J,K){var I=this;this.url=J;this.$watch=H;this.isWatching=E.getIsWatching();this.watchableType=K;this.$watch.on("click",L);C.bindAll(this,"toggleWatch","toggleUnwatch","toggleTrigger");function L(N){N.preventDefault();var M=!I.isWatching;I.toggleTrigger(M);return F.rest({url:I.url,type:I.isWatching?"DELETE":"POST",statusCode:{"401":function(Q,S,P,R,O){return G.extend({},O,{title:A.I18n.getText("stash.web.watch.default.error.401.title"),message:A.I18n.getText("stash.web.watch.default.error.401.message"),fallbackUrl:false,shouldReload:true})},"409":function(Q,S,P,R,O){return G.extend({},O,{title:A.I18n.getText("stash.web.watch.default.error.409.title"),fallbackUrl:false,shouldReload:true})}}}).done(function(){I.isWatching=M;E.setIsWatching(M)}).fail(function(){I.toggleTrigger(I.isWatching)})}}B.prototype.setIsWatching=function(H){this.toggleTrigger(H);this.isWatching=H;if(E.getIsWatching()!==H){E.setIsWatching(H)}};B.prototype.toggleWatch=function(){this.toggleTrigger(true)};B.prototype.toggleUnwatch=function(){this.toggleTrigger(false)};B.prototype.toggleTrigger=function(I){var H;switch(this.watchableType){case B.type.COMMIT:H=stash.feature.watch.commitLabel({isWatching:I});break;case B.type.PULL_REQUEST:H=stash.feature.watch.pullRequestLabel({isWatching:I});break}this.$watch.fadeOut(200,function(){G(this).html(H).fadeIn(200)})};B.prototype.destroy=function(){this.url=null;this.$watch=null;this.isWatching=null};B.type=D;return B});

Zerion Mini Shell 1.0