aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/provisioning/list-footer-view.js
blob: 6dc243e7b67ef2dea86456763eb08fe19bb1ea35 (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
define([
  './templates'
], function () {

  return Marionette.ItemView.extend({
    template: Templates['provisioning-list-footer'],

    collectionEvents: {
      'all': 'render'
    },

    events: {
      'click #provisioning-fetch-more': 'onMoreClick'
    },

    onMoreClick: function (e) {
      e.preventDefault();
      this.fetchMore();
    },

    fetchMore: function () {
      this.collection.fetchMore();
    },

    serializeData: function () {
      return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
        total: this.collection.total,
        count: this.collection.length,
        more: this.collection.hasMore()
      });
    }
  });

});