aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js109
1 files changed, 54 insertions, 55 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
index 33d95a47b5f..82d8c26f297 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profiles-view.js
@@ -1,66 +1,65 @@
-define([
- './profile-view',
- './profiles-empty-view',
- './templates'
-], function (ProfileView, ProfilesEmptyView) {
+import Marionette from 'backbone.marionette';
+import ProfileView from './profile-view';
+import ProfilesEmptyView from './profiles-empty-view';
+import './templates';
- return Marionette.CompositeView.extend({
- className: 'list-group',
- template: Templates['quality-profiles-profiles'],
- languageTemplate: Templates['quality-profiles-profiles-language'],
- childView: ProfileView,
- childViewContainer: '.js-list',
- emptyView: ProfilesEmptyView,
+export default Marionette.CompositeView.extend({
+ className: 'list-group',
+ template: Templates['quality-profiles-profiles'],
+ languageTemplate: Templates['quality-profiles-profiles-language'],
+ childView: ProfileView,
+ childViewContainer: '.js-list',
+ emptyView: ProfilesEmptyView,
- collectionEvents: {
- 'filter': 'filterByLanguage'
- },
+ collectionEvents: {
+ 'filter': 'filterByLanguage'
+ },
- childViewOptions: function (model) {
- return {
- collectionView: this,
- highlighted: model.get('key') === this.highlighted
- };
- },
+ childViewOptions: function (model) {
+ return {
+ collectionView: this,
+ highlighted: model.get('key') === this.highlighted
+ };
+ },
- highlight: function (key) {
- this.highlighted = key;
- this.render();
- },
+ highlight: function (key) {
+ this.highlighted = key;
+ this.render();
+ },
- attachHtml: function (compositeView, childView, index) {
- var $container = this.getChildViewContainer(compositeView),
- model = this.collection.at(index);
- if (model != null) {
- var prev = this.collection.at(index - 1),
- putLanguage = prev == null;
- if (prev != null) {
- var lang = model.get('language'),
- prevLang = prev.get('language');
- if (lang !== prevLang) {
- putLanguage = true;
- }
- }
- if (putLanguage) {
- $container.append(this.languageTemplate(model.toJSON()));
+ attachHtml: function (compositeView, childView, index) {
+ var $container = this.getChildViewContainer(compositeView),
+ model = this.collection.at(index);
+ if (model != null) {
+ var prev = this.collection.at(index - 1),
+ putLanguage = prev == null;
+ if (prev != null) {
+ var lang = model.get('language'),
+ prevLang = prev.get('language');
+ if (lang !== prevLang) {
+ putLanguage = true;
}
}
- compositeView._insertAfter(childView);
- },
-
- destroyChildren: function () {
- Marionette.CompositeView.prototype.destroyChildren.apply(this, arguments);
- this.$('.js-list-language').remove();
- },
-
- filterByLanguage: function (language) {
- if (language) {
- this.$('[data-language]').addClass('hidden');
- this.$('[data-language="' + language + '"]').removeClass('hidden');
- } else {
- this.$('[data-language]').removeClass('hidden');
+ if (putLanguage) {
+ $container.append(this.languageTemplate(model.toJSON()));
}
}
- });
+ compositeView._insertAfter(childView);
+ },
+
+ destroyChildren: function () {
+ Marionette.CompositeView.prototype.destroyChildren.apply(this, arguments);
+ this.$('.js-list-language').remove();
+ },
+ filterByLanguage: function (language) {
+ if (language) {
+ this.$('[data-language]').addClass('hidden');
+ this.$('[data-language="' + language + '"]').removeClass('hidden');
+ } else {
+ this.$('[data-language]').removeClass('hidden');
+ }
+ }
});
+
+