aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/coding-rules
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/app.js14
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js43
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/controller.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets-view.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/filters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/layout.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/models/state.js2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/partials.js8
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js7
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js4
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js6
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js9
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js6
37 files changed, 154 insertions, 90 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/app.js b/server/sonar-web/src/main/js/apps/coding-rules/app.js
index e1e53516f05..61089511594 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/app.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/app.js
@@ -5,16 +5,20 @@ import Marionette from 'backbone.marionette';
import State from './models/state';
import Layout from './layout';
import Rules from './models/rules';
-import Facets from 'components/navigator/models/facets';
+import Facets from '../../components/navigator/models/facets';
import Controller from './controller';
-import Router from 'components/navigator/router';
+import Router from '../../components/navigator/router';
import WorkspaceListView from './workspace-list-view';
import WorkspaceHeaderView from './workspace-header-view';
import FacetsView from './facets-view';
import FiltersView from './filters-view';
+import './partials';
+import '../../helpers/handlebars-helpers';
var App = new Marionette.Application(),
- init = function (options) {
+ init = function () {
+ let options = window.sonarqube;
+
this.layout = new Layout({ el: options.el });
this.layout.render();
$('#footer').addClass('search-navigator-footer');
@@ -92,9 +96,9 @@ var appXHR = $.get(baseUrl + '/api/rules/app').done(function (r) {
});
App.on('start', function (options) {
- $.when(window.requestMessages(), appXHR).done(function () {
+ appXHR.done(function () {
init.call(App, options);
});
});
-export default App;
+window.sonarqube.appStarted.then(options => App.start(options));
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
index 76e193d8f33..f8dcd2570a4 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-modal-view.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import './templates';
+import ModalFormView from '../../components/common/modal-form';
+import Template from './templates/coding-rules-bulk-change-modal.hbs';
export default ModalFormView.extend({
- template: Templates['coding-rules-bulk-change-modal'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
index 6d6268f3ef6..881b84434de 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/bulk-change-popup-view.js
@@ -1,11 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import PopupView from 'components/common/popup';
+import PopupView from '../../components/common/popup';
import BulkChangeModalView from './bulk-change-modal-view';
-import './templates';
+import Template from './templates/coding-rules-bulk-change-popup.hbs';
export default PopupView.extend({
- template: Templates['coding-rules-bulk-change-popup'],
+ template: Template,
events: {
'click .js-bulk-change': 'doAction'
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js b/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js
new file mode 100644
index 00000000000..624f3e8b997
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/coding-rules/confirm-dialog.js
@@ -0,0 +1,43 @@
+import $ from 'jquery';
+import _ from 'underscore';
+
+const DEFAULTS = {
+ title: 'Confirmation',
+ html: '',
+ yesLabel: 'Yes',
+ noLabel: 'Cancel',
+ yesHandler: function () {
+ // no op
+ },
+ noHandler: function () {
+ // no op
+ },
+ always: function () {
+ // no op
+ }
+};
+
+export default function (options) {
+ var settings = _.extend({}, DEFAULTS, options),
+ dialog = $('<div><div class="modal-head"><h2>' + settings.title + '</h2></div><div class="modal-body">' +
+ settings.html + '</div><div class="modal-foot"><button data-confirm="yes">' + settings.yesLabel +
+ '</button> <a data-confirm="no" class="action">' + settings.noLabel + '</a></div></div>');
+
+ $('[data-confirm=yes]', dialog).on('click', function () {
+ dialog.dialog('close');
+ settings.yesHandler();
+ return settings.always();
+ });
+
+ $('[data-confirm=no]', dialog).on('click', function () {
+ dialog.dialog('close');
+ settings.noHandler();
+ return settings.always();
+ });
+
+ return dialog.dialog({
+ modal: true,
+ minHeight: null,
+ width: 540
+ });
+}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
index 2049cb8bf0c..e399ddb9acc 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js
@@ -1,6 +1,6 @@
import $ from 'jquery';
import _ from 'underscore';
-import Controller from 'components/navigator/controller';
+import Controller from '../../components/navigator/controller';
import Rule from './models/rule';
import RuleDetailsView from './rule-details-view';
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js b/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
index c3da8bbe54b..22246af5046 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets-view.js
@@ -1,4 +1,4 @@
-import FacetsView from 'components/navigator/facets-view';
+import FacetsView from '../../components/navigator/facets-view';
import BaseFacet from './facets/base-facet';
import QueryFacet from './facets/query-facet';
import KeyFacet from './facets/key-facet';
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
index 0f0de13b0de..35ae3641ba5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/active-severity-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-severity-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-severity-facet'],
+ template: Template,
severities: ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'],
initialize: function (options) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
index 3f2f6a2839f..253c636bd8f 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/available-since-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-available-since-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-available-since-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
index f02260069cb..ebdca1169e0 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/base-facet.js
@@ -1,9 +1,9 @@
-import BaseFacet from 'components/navigator/facets/base-facet';
-import '../templates';
+import BaseFacet from '../../../components/navigator/facets/base-facet';
+import Template from '../templates/facets/coding-rules-base-facet.hbs';
export default BaseFacet.extend({
className: 'search-navigator-facet-box',
- template: Templates['coding-rules-base-facet']
+ template: Template
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
index 5463b4e13bc..9ab26b33caf 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/characteristic-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-characteristic-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-characteristic-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
index c2499876610..ba35fe660ed 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/custom-values-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-custom-values-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-custom-values-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
index e3dc2c2cafc..ecf8ba9dde9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/inheritance-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-inheritance-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-inheritance-facet'],
+ template: Template,
initialize: function (options) {
this.listenTo(options.app.state, 'change:query', this.onQueryChange);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
index 4117345bd4b..b2854b5028a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/key-facet.js
@@ -1,9 +1,9 @@
import BaseFacet from './base-facet';
import _ from 'underscore';
-import '../templates';
+import Template from '../templates/facets/coding-rules-key-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-key-facet'],
+ template: Template,
onRender: function () {
this.$el.toggleClass('hidden', !this.options.app.state.get('query').rule_key);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
index 5686d6b2cea..c04d56f93ee 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-quality-profile-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-quality-profile-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
index fe380885438..0b1216ca4bd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/query-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-query-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-query-facet'],
+ template: Template,
events: function () {
return _.extend(BaseFacet.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
index 6ab2c4f8a4d..9c019f36b95 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/severity-facet.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-severity-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-severity-facet'],
+ template: Template,
severities: ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR'],
sortValues: function (values) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
index bf819b33b5f..13c5cd7b405 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/template-facet.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
import BaseFacet from './base-facet';
-import '../templates';
+import Template from '../templates/facets/coding-rules-template-facet.hbs';
export default BaseFacet.extend({
- template: Templates['coding-rules-template-facet'],
+ template: Template,
onRender: function () {
BaseFacet.prototype.onRender.apply(this, arguments);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js b/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
index 37644b06ee9..ff902dec733 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/filters-view.js
@@ -1,10 +1,10 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import ManualRuleCreationView from './rule/manual-rule-creation-view';
-import './templates';
+import Template from './templates/coding-rules-filters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-filters'],
+ template: Template,
events: {
'click .js-create-manual-rule': 'createManualRule'
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/layout.js b/server/sonar-web/src/main/js/apps/coding-rules/layout.js
index ee83c4d684d..ef24f8ce321 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/layout.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/layout.js
@@ -1,9 +1,9 @@
import $ from 'jquery';
import Marionette from 'backbone.marionette';
-import './templates';
+import Template from './templates/coding-rules-layout.hbs';
export default Marionette.LayoutView.extend({
- template: Templates['coding-rules-layout'],
+ template: Template,
regions: {
filtersRegion: '.search-navigator-filters',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/state.js b/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
index da1dcad586c..952bff0d252 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/models/state.js
@@ -1,4 +1,4 @@
-import State from 'components/navigator/models/state';
+import State from '../../../components/navigator/models/state';
export default State.extend({
defaults: {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/partials.js b/server/sonar-web/src/main/js/apps/coding-rules/partials.js
new file mode 100644
index 00000000000..9eb9de128e6
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/coding-rules/partials.js
@@ -0,0 +1,8 @@
+import Handlebars from 'hbsfy/runtime';
+import ActivationPartial from './templates/_coding-rules-workspace-list-item-activation.hbs';
+import FacetHeaderPartial from './templates/facets/_coding-rules-facet-header.hbs';
+import MarkdownTipsPartial from '../../components/common/templates/_markdown-tips.hbs';
+
+Handlebars.registerPartial('_coding-rules-workspace-list-item-activation', ActivationPartial);
+Handlebars.registerPartial('_coding-rules-facet-header', FacetHeaderPartial);
+Handlebars.registerPartial('_markdown-tips', MarkdownTipsPartial);
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
index c33ea38e401..f8dee5b02cd 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-details-view.js
@@ -11,11 +11,12 @@ import CustomRulesView from './rule/custom-rules-view';
import ManualRuleCreationView from './rule/manual-rule-creation-view';
import CustomRuleCreationView from './rule/custom-rule-creation-view';
import IssuesView from './rule/rule-issues-view';
-import './templates';
+import Template from './templates/coding-rules-rule-details.hbs';
+import confirmDialog from './confirm-dialog';
export default Marionette.LayoutView.extend({
className: 'coding-rule-details',
- template: Templates['coding-rules-rule-details'],
+ template: Template,
regions: {
metaRegion: '.js-rule-meta',
@@ -128,7 +129,7 @@ export default Marionette.LayoutView.extend({
deleteRule: function () {
var that = this,
ruleType = this.model.has('templateKey') ? 'custom' : 'manual';
- window.confirmDialog({
+ confirmDialog({
title: t('delete'),
html: tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
index bb9acd5ccef..b2dc3619cf9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule-filter-view.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
-import ActionOptionsView from 'components/common/action-options-view';
-import './templates';
+import ActionOptionsView from '../../components/common/action-options-view';
+import Template from './templates/coding-rules-rule-filter-form.hbs';
export default ActionOptionsView.extend({
- template: Templates['coding-rules-rule-filter-form'],
+ template: Template,
selectOption: function (e) {
var property = $(e.currentTarget).data('property'),
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
index dbaf9af0d64..d3e9d49ba6b 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-creation-view.js
@@ -1,10 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import '../templates';
+import ModalFormView from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-custom-rule-creation.hbs';
+import {csvEscape} from '../../../helpers/csv';
+import latinize from '../../../helpers/latinize';
export default ModalFormView.extend({
- template: Templates['coding-rules-custom-rule-creation'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this, arguments), {
@@ -38,7 +40,7 @@ export default ModalFormView.extend({
generateKey: function () {
if (!this.keyModifiedByUser && this.ui.customRuleCreationKey) {
- var generatedKey = this.ui.customRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_');
+ var generatedKey = latinize(this.ui.customRuleCreationName.val()).replace(/[^A-Za-z0-9]/g, '_');
this.ui.customRuleCreationKey.val(generatedKey);
}
},
@@ -107,7 +109,7 @@ export default ModalFormView.extend({
};
}).get();
options.params = params.map(function (param) {
- return param.key + '=' + window.csvEscape(param.value);
+ return param.key + '=' + csvEscape(param.value);
}).join(';');
this.sendRequest(action, options);
},
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
index a47aef607b8..43f577429a9 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rule-view.js
@@ -1,11 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-custom-rule.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['coding-rules-custom-rule'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -17,7 +18,7 @@ export default Marionette.ItemView.extend({
deleteRule: function () {
var that = this;
- window.confirmDialog({
+ confirmDialog({
title: t('delete'),
html: t('are_you_sure'),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
index 7486abbb573..c550708d0aa 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/custom-rules-view.js
@@ -2,10 +2,10 @@ import _ from 'underscore';
import Marionette from 'backbone.marionette';
import CustomRuleView from './custom-rule-view';
import CustomRuleCreationView from './custom-rule-creation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-custom-rules.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['coding-rules-custom-rules'],
+ template: Template,
childView: CustomRuleView,
childViewContainer: '#coding-rules-detail-custom-rules',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
index f0890a06e08..d5c5dd07fbf 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/manual-rule-creation-view.js
@@ -1,10 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import ModalFormView from 'components/common/modal-form';
-import '../templates';
+import ModalFormView from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-manual-rule-creation.hbs';
+import latinize from '../../../helpers/latinize';
export default ModalFormView.extend({
- template: Templates['coding-rules-manual-rule-creation'],
+ template: Template,
ui: function () {
return _.extend(ModalFormView.prototype.ui.apply(this.arguments), {
@@ -44,7 +45,7 @@ export default ModalFormView.extend({
generateKey: function () {
if (!this.keyModifiedByUser && this.ui.manualRuleCreationKey) {
- var generatedKey = this.ui.manualRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_');
+ var generatedKey = latinize(this.ui.manualRuleCreationName.val()).replace(/[^A-Za-z0-9]/g, '_');
this.ui.manualRuleCreationKey.val(generatedKey);
}
},
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
index 8ea8ce0496d..e20be1987e7 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/profile-activation-view.js
@@ -1,11 +1,12 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
-import ModalForm from 'components/common/modal-form';
-import '../templates';
+import ModalForm from '../../../components/common/modal-form';
+import Template from '../templates/rule/coding-rules-profile-activation.hbs';
+import {csvEscape} from '../../../helpers/csv';
export default ModalForm.extend({
- template: Templates['coding-rules-profile-activation'],
+ template: Template,
ui: function () {
return _.extend(this._super(), {
@@ -62,7 +63,7 @@ export default ModalForm.extend({
};
}).get(),
paramsHash = (params.map(function (param) {
- return param.key + '=' + window.csvEscape(param.value);
+ return param.key + '=' + csvEscape(param.value);
})).join(';');
if (this.model) {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
index e49e2bb2a75..f169121e376 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-description-view.js
@@ -1,10 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-description.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-description'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -62,7 +63,7 @@ export default Marionette.ItemView.extend({
removeExtendedDescription: function () {
var that = this;
- window.confirmDialog({
+ confirmDialog({
html: t('coding_rules.remove_extended_description.confirm'),
yesHandler: function () {
that.ui.extendDescriptionText.val('');
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
index 0bd9da9bdac..fa4e771efd3 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-issues-view.js
@@ -1,10 +1,10 @@
import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-issues.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-issues'],
+ template: Template,
initialize: function () {
var that = this;
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
index f2b947343dd..73540c26b77 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-meta-view.js
@@ -2,10 +2,10 @@ import $ from 'jquery';
import _ from 'underscore';
import Marionette from 'backbone.marionette';
import RuleFilterMixin from './rule-filter-mixin';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-meta.hbs';
export default Marionette.ItemView.extend(RuleFilterMixin).extend({
- template: Templates['coding-rules-rule-meta'],
+ template: Template,
modelEvents: {
'change': 'render'
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
index fc34437c23c..54f85d7eaa1 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-parameters-view.js
@@ -1,9 +1,9 @@
import _ from 'underscore';
import Marionette from 'backbone.marionette';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-parameters.hbs';
export default Marionette.ItemView.extend({
- template: Templates['coding-rules-rule-parameters'],
+ template: Template,
modelEvents: {
'change': 'render'
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
index 40e09aed4a4..1c74fc9dd63 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profile-view.js
@@ -3,11 +3,12 @@ import _ from 'underscore';
import Backbone from 'backbone';
import Marionette from 'backbone.marionette';
import ProfileActivationView from './profile-activation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-profile.hbs';
+import confirmDialog from '../confirm-dialog';
export default Marionette.ItemView.extend({
tagName: 'tr',
- template: Templates['coding-rules-rule-profile'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -48,7 +49,7 @@ export default Marionette.ItemView.extend({
revert: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.revert_to_parent_definition'),
html: tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name),
yesHandler: function () {
@@ -70,7 +71,7 @@ export default Marionette.ItemView.extend({
deactivate: function () {
var that = this,
ruleKey = this.options.rule.get('key');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.deactivate'),
html: tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
index f449d944473..5f9f497acba 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/rule/rule-profiles-view.js
@@ -2,10 +2,10 @@ import _ from 'underscore';
import Marionette from 'backbone.marionette';
import ProfileView from './rule-profile-view';
import ProfileActivationView from './profile-activation-view';
-import '../templates';
+import Template from '../templates/rule/coding-rules-rule-profiles.hbs';
export default Marionette.CompositeView.extend({
- template: Templates['coding-rules-rule-profiles'],
+ template: Template,
childView: ProfileView,
childViewContainer: '#coding-rules-detail-quality-profiles',
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
index 74b1a14dc50..01028a952f6 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-header-view.js
@@ -1,11 +1,11 @@
import $ from 'jquery';
import _ from 'underscore';
-import WorkspaceHeaderView from 'components/navigator/workspace-header-view';
+import WorkspaceHeaderView from '../../components/navigator/workspace-header-view';
import BulkChangePopup from './bulk-change-popup-view';
-import './templates';
+import Template from './templates/coding-rules-workspace-header.hbs';
export default WorkspaceHeaderView.extend({
- template: Templates['coding-rules-workspace-header'],
+ template: Template,
events: function () {
return _.extend(WorkspaceHeaderView.prototype.events.apply(this, arguments), {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
index 4fda1255c8c..e4e70351b97 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
@@ -1,14 +1,15 @@
import $ from 'jquery';
import _ from 'underscore';
import Backbone from 'backbone';
-import WorkspaceListItemView from 'components/navigator/workspace-list-item-view';
+import WorkspaceListItemView from '../../components/navigator/workspace-list-item-view';
import ProfileActivationView from './rule/profile-activation-view';
import RuleFilterMixin from './rule/rule-filter-mixin';
-import './templates';
+import Template from './templates/coding-rules-workspace-list-item.hbs';
+import confirmDialog from './confirm-dialog';
export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
className: 'coding-rule',
- template: Templates['coding-rules-workspace-list-item'],
+ template: Template,
modelEvents: {
'change': 'render'
@@ -60,7 +61,7 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
var that = this,
ruleKey = this.model.get('key'),
activation = this.model.get('activation');
- window.confirmDialog({
+ confirmDialog({
title: t('coding_rules.deactivate'),
html: tp('coding_rules.deactivate.confirm'),
yesHandler: function () {
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
index 252d5a093ce..1d7036b593e 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
@@ -1,10 +1,10 @@
-import WorkspaceListView from 'components/navigator/workspace-list-view';
+import WorkspaceListView from '../../components/navigator/workspace-list-view';
import WorkspaceListItemView from './workspace-list-item-view';
import WorkspaceListEmptyView from './workspace-list-empty-view';
-import './templates';
+import Template from './templates/coding-rules-workspace-list.hbs';
export default WorkspaceListView.extend({
- template: Templates['coding-rules-workspace-list'],
+ template: Template,
childView: WorkspaceListItemView,
childViewContainer: '.js-list',
emptyView: WorkspaceListEmptyView,