-// Generated by CoffeeScript 1.6.3
+// Generated by CoffeeScript 1.7.1
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
define(['backbone.marionette', 'handlebars'], function(Marionette, Handlebars) {
- var QualityGateDetailConditionView, _ref;
+ var QualityGateDetailConditionView;
return QualityGateDetailConditionView = (function(_super) {
__extends(QualityGateDetailConditionView, _super);
function QualityGateDetailConditionView() {
- _ref = QualityGateDetailConditionView.__super__.constructor.apply(this, arguments);
- return _ref;
+ return QualityGateDetailConditionView.__super__.constructor.apply(this, arguments);
}
QualityGateDetailConditionView.prototype.tagName = 'tr';
metric = _.findWhere(this.options.app.metrics, {
key: metricKey
});
- return this.model.set({
+ this.model.set({
metric: metric
}, {
silent: true
});
+ return this.model.set({
+ isDiffMetric: metric.key.indexOf('new_') === 0
+ }, {
+ silent: true
+ });
};
QualityGateDetailConditionView.prototype.onRender = function() {
};
QualityGateDetailConditionView.prototype.saveCondition = function() {
- var _this = this;
this.showSpinner();
this.model.set({
period: this.ui.periodSelect.val(),
warning: this.ui.warningInput.val(),
error: this.ui.errorInput.val()
});
- return this.model.save().always(function() {
- _this.ui.updateButton.prop('disabled', true);
- return _this.hideSpinner();
- }).done(function() {
- return _this.options.collectionView.updateConditions();
- });
+ return this.model.save().always((function(_this) {
+ return function() {
+ _this.ui.updateButton.prop('disabled', true);
+ return _this.hideSpinner();
+ };
+ })(this)).done((function(_this) {
+ return function() {
+ return _this.options.collectionView.updateConditions();
+ };
+ })(this));
};
QualityGateDetailConditionView.prototype.deleteCondition = function() {
- var _this = this;
if (confirm(t('are_you_sure'))) {
this.showSpinner();
- return this.model["delete"]().done(function() {
- _this.options.collectionView.updateConditions();
- return _this.close();
- });
+ return this.model["delete"]().done((function(_this) {
+ return function() {
+ _this.options.collectionView.updateConditions();
+ return _this.close();
+ };
+ })(this));
}
};
QualityGateDetailConditionView.prototype.serializeData = function() {
var period;
period = _.findWhere(this.options.app.periods, {
- key: '' + this.model.get('period')
+ key: this.model.get('period')
});
return _.extend(QualityGateDetailConditionView.__super__.serializeData.apply(this, arguments), {
canEdit: this.options.app.canEdit,