aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/computation/list-item-view.js
blob: 44e5e32dcaf6c2c9502ff177db1f84737424d5e7 (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
define([
  'backbone.marionette',
  './templates'
], function (Marionette) {

  return Marionette.ItemView.extend({
    tagName: 'li',
    className: 'panel',
    template: Templates['computation-list-item'],

    onRender: function () {
      this.$el.attr('data-id', this.model.id);
      this.$el.toggleClass('panel-danger', this.model.isDanger());
      this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
    },

    onDestroy: function () {
      this.$('[data-toggle="tooltip"]').tooltip('destroy');
    },

    serializeData: function () {
      return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
        duration: this.model.getDuration()
      });
    }
  });

});