aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
blob: 01028a952f690de9ae2a5ab9258a21c1faa85b66 (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
40
41
42
43
44
45
46
47
48
import $ from 'jquery';
import _ from 'underscore';
import WorkspaceHeaderView from '../../components/navigator/workspace-header-view';
import BulkChangePopup from './bulk-change-popup-view';
import Template from './templates/coding-rules-workspace-header.hbs';

export default WorkspaceHeaderView.extend({
  template: Template,

  events: function () {
    return _.extend(WorkspaceHeaderView.prototype.events.apply(this, arguments), {
      'click .js-back': 'onBackClick',
      'click .js-bulk-change': 'onBulkChangeClick',
      'click .js-reload': 'reload',
      'click .js-new-search': 'newSearch'
    });
  },

  onBackClick: function () {
    this.options.app.controller.hideDetails();
  },

  onBulkChangeClick: function (e) {
    e.stopPropagation();
    $('body').click();
    new BulkChangePopup({
      app: this.options.app,
      triggerEl: $(e.currentTarget),
      bottomRight: true
    }).render();
  },

  reload: function () {
    this.options.app.controller.fetchList(true);
  },

  newSearch: function () {
    this.options.app.controller.newSearch();
  },

  serializeData: function () {
    return _.extend(WorkspaceHeaderView.prototype.serializeData.apply(this, arguments), {
      canWrite: this.options.app.canWrite
    });
  }
});