aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/coding-rules/rule/rule-parameters-view.js
blob: f2572460033ddf52325d03385603018b0e4b1b9c (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
define([
    'backbone.marionette',
    'templates/coding-rules'
], function (Marionette, Templates) {

  return Marionette.ItemView.extend({
    template: Templates['coding-rules-rule-parameters'],

    modelEvents: {
      'change': 'render'
    },

    onRender: function () {
      this.$el.toggleClass('hidden', _.isEmpty(this.model.get('params')));
    },

    serializeData: function () {
      var isEditable = this.options.app.canWrite && (this.model.get('isManual') || this.model.get('isCustom'));

      return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
        isEditable: isEditable,
        canWrite: this.options.app.canWrite
      });
    }
  });

});