blob: 3dfea4a584ea960613879001d0dd6a5deb7af168 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
define([
'./form-view'
], function (FormView) {
return FormView.extend({
sendRequest: function () {
var that = this;
this.model.set({
key: this.$('#create-metric-key').val(),
name: this.$('#create-metric-name').val(),
description: this.$('#create-metric-description').val(),
domain: this.$('#create-metric-domain').val(),
type: this.$('#create-metric-type').val()
});
this.disableForm();
return this.model.save(null, {
statusCode: {
// do not show global error
400: null
}
}).done(function () {
that.collection.refresh();
that.destroy();
}).fail(function (jqXHR) {
that.enableForm();
that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
});
}
});
});
|