aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/javascripts/quality-gate/views/quality-gate-detail-renaming-view.js
blob: 425cc2cdbc637f3ca9bb0a3290d4736e5e3477fb (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Generated by CoffeeScript 1.6.3
(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 QualityGateDetailRenamingView, _ref;
    return QualityGateDetailRenamingView = (function(_super) {
      __extends(QualityGateDetailRenamingView, _super);

      function QualityGateDetailRenamingView() {
        _ref = QualityGateDetailRenamingView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      QualityGateDetailRenamingView.prototype.template = Handlebars.compile(jQuery('#quality-gate-detail-renaming-template').html());

      QualityGateDetailRenamingView.prototype.ui = {
        input: '#quality-gate-renaming-input'
      };

      QualityGateDetailRenamingView.prototype.events = {
        'click #quality-gate-rename': 'rename',
        'click #quality-gate-cancel-rename': 'cancel'
      };

      QualityGateDetailRenamingView.prototype.onDomRefresh = function() {
        return this.ui.input.focus();
      };

      QualityGateDetailRenamingView.prototype.rename = function() {
        var newName,
          _this = this;
        this.options.detailView.showHeaderSpinner();
        newName = this.ui.input.val();
        return jQuery.ajax({
          url: "" + baseUrl + "/api/qualitygates/rename",
          type: 'POST',
          data: {
            id: this.model.id,
            name: newName
          }
        }).done(function() {
          _this.model.set('name', newName);
          _this.options.detailView.showHeader();
          return _this.options.detailView.hideHeaderSpinner();
        });
      };

      QualityGateDetailRenamingView.prototype.cancel = function() {
        return this.options.detailView.showHeader();
      };

      return QualityGateDetailRenamingView;

    })(Marionette.ItemView);
  });

}).call(this);

/*
//@ sourceMappingURL=quality-gate-detail-renaming-view.map
*/