2017-01-11 23:27:41 -05:00
|
|
|
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, max-len */
|
2016-12-14 00:26:26 -05:00
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
(function() {
|
2017-01-11 23:27:41 -05:00
|
|
|
var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; };
|
2016-07-24 16:45:11 -04:00
|
|
|
|
|
|
|
this.MergedButtons = (function() {
|
|
|
|
function MergedButtons() {
|
|
|
|
this.removeSourceBranch = bind(this.removeSourceBranch, this);
|
|
|
|
this.$removeBranchWidget = $('.remove_source_branch_widget');
|
|
|
|
this.$removeBranchProgress = $('.remove_source_branch_in_progress');
|
|
|
|
this.$removeBranchFailed = $('.remove_source_branch_widget.failed');
|
|
|
|
this.cleanEventListeners();
|
|
|
|
this.initEventListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
MergedButtons.prototype.cleanEventListeners = function() {
|
|
|
|
$(document).off('click', '.remove_source_branch');
|
|
|
|
$(document).off('ajax:success', '.remove_source_branch');
|
|
|
|
return $(document).off('ajax:error', '.remove_source_branch');
|
|
|
|
};
|
|
|
|
|
|
|
|
MergedButtons.prototype.initEventListeners = function() {
|
|
|
|
$(document).on('click', '.remove_source_branch', this.removeSourceBranch);
|
|
|
|
$(document).on('ajax:success', '.remove_source_branch', this.removeBranchSuccess);
|
|
|
|
return $(document).on('ajax:error', '.remove_source_branch', this.removeBranchError);
|
|
|
|
};
|
|
|
|
|
|
|
|
MergedButtons.prototype.removeSourceBranch = function() {
|
|
|
|
this.$removeBranchWidget.hide();
|
|
|
|
return this.$removeBranchProgress.show();
|
|
|
|
};
|
|
|
|
|
|
|
|
MergedButtons.prototype.removeBranchSuccess = function() {
|
|
|
|
return location.reload();
|
|
|
|
};
|
|
|
|
|
|
|
|
MergedButtons.prototype.removeBranchError = function() {
|
|
|
|
this.$removeBranchWidget.hide();
|
|
|
|
this.$removeBranchProgress.hide();
|
|
|
|
return this.$removeBranchFailed.show();
|
|
|
|
};
|
|
|
|
|
|
|
|
return MergedButtons;
|
|
|
|
})();
|
2017-02-10 01:50:50 -05:00
|
|
|
}).call(window);
|