aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/coding-rules/models/rule.js
blob: 0b20c8eab0d633729ecd58b0440f1d9fa71b92a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
define([
    'backbone'
], function (Backbone) {

  return Backbone.Model.extend({
    idAttribute: 'key',

    addExtraAttributes: function (languages, repositories) {
      var langName = languages[this.get('lang')] || this.get('lang'),
          repo = _.findWhere(repositories, { key: this.get('repo') }) || this.get('repo'),
          isManual = this.get('repo') === 'manual',
          isCustom = this.has('templateKey');
      this.set({
        langName: langName,
        repo: repo,
        isManual: isManual,
        isCustom: isCustom
      });
    }
  });

});