aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/groups/create-view.js
blob: 8d5cfce55aaf2287ff06d365625032efa1c54cc7 (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
define([
  './group',
  './form-view'
], function (Group, FormView) {

  return FormView.extend({

    sendRequest: function () {
      var that = this,
          group = new Group({
            name: this.$('#create-group-name').val(),
            description: this.$('#create-group-description').val()
          });
      this.disableForm();
      return group.save(null, {
        statusCode: {
          // do not show global error
          400: null
        }
      }).done(function () {
        that.collection.refresh();
        that.close();
      }).fail(function (jqXHR) {
        that.enableForm();
        that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
      });
    }
  });

});