aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js
blob: 0a8ab42427330e94880d16db746f07a00f92bb91 (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
define([
  'backbone.marionette',
    './templates'
], function (Marionette) {

  return Marionette.ItemView.extend({
    template: Templates['quality-profile-changelog'],

    events: {
      'submit #quality-profile-changelog-form': 'onFormSubmit',
      'click .js-show-more-changelog': 'onShowMoreChangelogClick',
      'click .js-hide-changelog': 'onHideChangelogClick'
    },

    onFormSubmit: function (e) {
      e.preventDefault();
      this.model.fetchChangelog(this.getSearchParameters());
    },

    onShowMoreChangelogClick: function (e) {
      e.preventDefault();
      this.model.fetchMoreChangelog();
    },

    onHideChangelogClick: function (e) {
      e.preventDefault();
      this.model.resetChangelog();
    },

    getSearchParameters: function () {
      var form = this.$('#quality-profile-changelog-form');
      return {
        since: form.find('[name="since"]').val(),
        to: form.find('[name="to"]').val()
      };
    }
  });

});