diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-08-24 13:50:18 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-08-26 10:12:03 +0200 |
commit | 223bcb955ba554be354f6b4b1ca0c1acb9431d66 (patch) | |
tree | c055f39d1cf688974d275877c5ff07490c32295f /server/sonar-web/src/main/js/apps/coding-rules | |
parent | 4fa812ee4cb69d00e761b7887fdd30820d6748a9 (diff) | |
download | sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.tar.gz sonarqube-223bcb955ba554be354f6b4b1ca0c1acb9431d66.zip |
use the single web app
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules')
27 files changed, 100 insertions, 367 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 61f5e97ddd2..67b18ef2b11 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 @@ -1,4 +1,6 @@ define([ + 'backbone', + 'backbone.marionette', './models/state', './layout', './models/rules', @@ -13,7 +15,9 @@ define([ './facets-view', './filters-view' ], - function (State, + function (Backbone, + Marionette, + State, Layout, Rules, Facets, @@ -71,7 +75,7 @@ define([ App.manualRepository = function () { return { key: 'manual', - name: t('coding_rules.manual_rule'), + name: window.t('coding_rules.manual_rule'), language: 'none' }; }; @@ -104,7 +108,7 @@ define([ }); App.on('start', function (options) { - $.when(window.requestMessages(), appXHR).done(function () { + $.when(appXHR).done(function () { init.call(App, 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 bdd2cbb5f34..d9bff5b021d 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 @@ -36,14 +36,14 @@ define([ showSuccessMessage: function (profile, succeeded) { var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }), profileName = profileBase != null ? profileBase.name : profile, - message = tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded); + message = window.tp('coding_rules.bulk_change.success', profileName, profileBase.language, succeeded); this.ui.messagesContainer.append('<div class="alert alert-success">' + message + '</div>'); }, showWarnMessage: function (profile, succeeded, failed) { var profileBase = _.findWhere(this.options.app.qualityProfiles, { key: profile }), profileName = profileBase != null ? profileBase.name : profile, - message = tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed); + message = window.tp('coding_rules.bulk_change.warning', profileName, profileBase.language, succeeded, failed); this.ui.messagesContainer.append('<div class="alert alert-warning">' + message + '</div>'); }, 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 6695943968d..7cabf7b44e2 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 @@ -46,7 +46,7 @@ define([ forbid: function () { BaseFacet.prototype.forbid.apply(this, arguments); - this.$el.prop('title', t('coding_rules.filters.active_severity.inactive')); + this.$el.prop('title', window.t('coding_rules.filters.active_severity.inactive')); }, allow: function () { 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 7aad57ad48c..b43aadb3ff1 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 @@ -32,7 +32,7 @@ define([ }, getUrl: function () { - return baseUrl; + return window.baseUrl; }, onRender: function () { @@ -42,17 +42,17 @@ define([ prepareSearch: function () { this.$('.js-custom-value').select2({ - placeholder: t('search_verb'), + placeholder: window.t('search_verb'), minimumInputLength: 1, allowClear: false, formatNoMatches: function () { - return t('select2.noMatches'); + return window.t('select2.noMatches'); }, formatSearching: function () { - return t('select2.searching'); + return window.t('select2.searching'); }, formatInputTooShort: function () { - return tp('select2.tooShort', 1); + return window.tp('select2.tooShort', 1); }, width: '100%', ajax: this.prepareAjaxSearch() 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 1a05fff7479..50bef351339 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 @@ -51,7 +51,7 @@ define([ forbid: function () { BaseFacet.prototype.forbid.apply(this, arguments); - this.$el.prop('title', t('coding_rules.filters.inheritance.inactive')); + this.$el.prop('title', window.t('coding_rules.filters.inheritance.inactive')); }, allow: function () { @@ -63,7 +63,7 @@ define([ var values = ['NONE', 'INHERITED', 'OVERRIDES']; return values.map(function (key) { return { - label: t('coding_rules.filters.inheritance', key.toLowerCase()), + label: window.t('coding_rules.filters.inheritance', key.toLowerCase()), val: key }; }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js index 478c589032c..1873599e3cd 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/language-facet.js @@ -24,7 +24,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/languages/list'; + return window.baseUrl + '/api/languages/list'; }, prepareAjaxSearch: function () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js index 08283dc5b18..ae064ba3b2a 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/repository-facet.js @@ -24,7 +24,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/rules/repositories'; + return window.baseUrl + '/api/rules/repositories'; }, prepareAjaxSearch: function () { diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js index 96854e47564..2d2b6b654e8 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/status-facet.js @@ -27,7 +27,7 @@ define([ getValues: function () { var values = this.model.getValues(); var x = values.map(function (value) { - return _.extend(value, { label: t('rules.status', value.val.toLowerCase()) }); + return _.extend(value, { label: window.t('rules.status', value.val.toLowerCase()) }); }); return x; }, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js index 9a5b0f21570..3e6a064ef6c 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/tag-facet.js @@ -24,7 +24,7 @@ define([ return CustomValuesFacet.extend({ getUrl: function () { - return baseUrl + '/api/rules/tags'; + return window.baseUrl + '/api/rules/tags'; }, prepareAjaxSearch: function () { 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 4626acd9d02..c7a289e9c29 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,26 +1,8 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', './rule/manual-rule-creation-view', './templates' -], function (ManualRuleCreationView) { +], function (Marionette, ManualRuleCreationView) { return Marionette.ItemView.extend({ template: Templates['coding-rules-filters'], @@ -36,7 +18,9 @@ define([ }, serializeData: function () { - return _.extend(this._super(), { canWrite: this.options.app.canWrite }); + return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { + canWrite: this.options.app.canWrite + }); } }); 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 34f66a61a2e..d2fff28e341 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,25 +1,8 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', + '../../components/common/jquery-isolated-scroll', './templates' -], function () { +], function (Marionette) { var $ = jQuery; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js index 51993df4b98..fbc5ecdd8b0 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/models/rule.js @@ -1,23 +1,6 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Model.extend({ idAttribute: 'key', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js b/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js index f1f83bcf1bd..39a833309e5 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/models/rules.js @@ -1,25 +1,7 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone', './rule' -], function (Rule) { +], function (Backbone, Rule) { return Backbone.Collection.extend({ model: Rule, 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 05856342aa4..f1536004dff 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 @@ -1,23 +1,6 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone', + 'backbone.marionette', './models/rules', './rule/rule-meta-view', './rule/rule-description-view', @@ -27,9 +10,12 @@ define([ './rule/manual-rule-creation-view', './rule/custom-rule-creation-view', './rule/rule-issues-view', + '../../components/common/dialogs', './templates' ], - function (Rules, + function (Backbone, + Marionette, + Rules, MetaView, DescView, ParamView, @@ -37,7 +23,8 @@ define([ CustomRulesView, ManualRuleCreationView, CustomRuleCreationView, - IssuesView) { + IssuesView, + confirmDialog) { var $ = jQuery; @@ -163,9 +150,9 @@ define([ deleteRule: function () { var that = this, ruleType = this.model.has('templateKey') ? 'custom' : 'manual'; - window.confirmDialog({ - title: t('delete'), - html: tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), + confirmDialog({ + title: window.t('delete'), + html: window.tp('coding_rules.delete.' + ruleType + '.confirm', this.model.get('name')), yesHandler: function () { var url = baseUrl + '/api/rules/delete', options = { key: that.model.id }; 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 e15a1149e69..1ee49177642 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 @@ -19,8 +19,9 @@ */ define([ 'components/common/modal-form', + '../../../libs/csv', '../templates' -], function (ModalFormView) { +], function (ModalFormView, csvEscape) { var $ = jQuery; @@ -128,7 +129,7 @@ define([ }; }).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); }, @@ -172,7 +173,7 @@ define([ }).fail(function (jqXHR) { if (jqXHR.status === 409) { that.existingRule = jqXHR.responseJSON.rule; - that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]); + that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]); that.ui.customRuleCreationCreate.addClass('hidden'); that.ui.customRuleCreationReactivate.removeClass('hidden'); } else { @@ -194,7 +195,7 @@ define([ var statuses = ['READY', 'BETA', 'DEPRECATED'].map(function (status) { return { id: status, - text: t('rules.status', status.toLowerCase()) + text: window.t('rules.status', status.toLowerCase()) }; }); 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 e50b7c11005..5dc0c9ac732 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,25 +1,8 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', + '../../../components/common/dialogs', '../templates' -], function () { +], function (Marionette, confirmDialog) { var $ = jQuery; @@ -37,9 +20,9 @@ define([ deleteRule: function () { var that = this; - window.confirmDialog({ - title: t('delete'), - html: t('are_you_sure'), + confirmDialog({ + title: window.t('delete'), + html: window.t('are_you_sure'), yesHandler: function () { var url = baseUrl + '/api/rules/delete', options = { key: that.model.id }; 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 56ae2a95833..bd51911930d 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 @@ -1,27 +1,9 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', './custom-rule-view', './custom-rule-creation-view', '../templates' -], function (CustomRuleView, CustomRuleCreationView) { +], function (Marionette, CustomRuleView, CustomRuleCreationView) { return Marionette.CompositeView.extend({ template: Templates['coding-rules-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 66617fc33ed..32c707f6c9a 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 @@ -119,7 +119,7 @@ define([ }).fail(function (jqXHR) { if (jqXHR.status === 409) { that.existingRule = jqXHR.responseJSON.rule; - that.showErrors([], [{ msg: t('coding_rules.reactivate.help') }]); + that.showErrors([], [{ msg: window.t('coding_rules.reactivate.help') }]); that.ui.manualRuleCreationCreate.addClass('hidden'); that.ui.manualRuleCreationReactivate.removeClass('hidden'); } else { 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 87296ca2e0f..663895b4823 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,26 +1,9 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone', 'components/common/modal-form', + '../../../libs/csv', '../templates' -], function (ModalForm) { +], function (Backbone, ModalForm, csvEscape) { var $ = jQuery; @@ -28,7 +11,7 @@ define([ template: Templates['coding-rules-profile-activation'], ui: function () { - return _.extend(this._super(), { + return _.extend(ModalForm.prototype.ui.apply(this, arguments), { qualityProfileSelect: '#coding-rules-quality-profile-activation-select', qualityProfileSeverity: '#coding-rules-quality-profile-activation-severity', qualityProfileActivate: '#coding-rules-quality-profile-activation-activate', @@ -37,13 +20,13 @@ define([ }, events: function () { - return _.extend(this._super(), { + return _.extend(ModalForm.prototype.events.apply(this, arguments), { 'click @ui.qualityProfileActivate': 'activate' }); }, onRender: function () { - this._super(); + ModalForm.prototype.onRender.apply(this, arguments); this.ui.qualityProfileSelect.select2({ width: '250px', @@ -82,7 +65,7 @@ define([ }; }).get(), paramsHash = (params.map(function (param) { - return param.key + '=' + window.csvEscape(param.value); + return param.key + '=' + csvEscape(param.value); })).join(';'); if (this.model) { @@ -146,7 +129,7 @@ define([ var availableProfiles = this.getAvailableQualityProfiles(this.options.rule.get('lang')); - return _.extend(this._super(), { + return _.extend(ModalForm.prototype.serializeData.apply(this, arguments), { change: this.model && this.model.has('severity'), params: params, qualityProfiles: availableProfiles, 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 c84213c614d..cd36bb7d3d9 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,25 +1,8 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', + '../../../components/common/dialogs', '../templates' -], function () { +], function (Marionette, confirmDialog) { return Marionette.ItemView.extend({ template: Templates['coding-rules-rule-description'], @@ -80,8 +63,8 @@ define([ removeExtendedDescription: function () { var that = this; - window.confirmDialog({ - html: t('coding_rules.remove_extended_description.confirm'), + confirmDialog({ + html: window.t('coding_rules.remove_extended_description.confirm'), yesHandler: function () { that.ui.extendDescriptionText.val(''); that.submitExtendDescription(); 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 ebbd0f62149..373c4a54a45 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,25 +1,7 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', '../templates' -], function () { +], function (Marionette) { var $ = jQuery; 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 d8565818c52..f31fbb7656e 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 @@ -1,26 +1,8 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', './rule-filter-mixin', '../templates' -], function (RuleFilterMixin) { +], function (Marionette, RuleFilterMixin) { return Marionette.ItemView.extend(RuleFilterMixin).extend({ template: Templates['coding-rules-rule-meta'], 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 2e5a927621d..d49a6adcb21 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,25 +1,7 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', '../templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ template: Templates['coding-rules-rule-parameters'], 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 42902e38c3c..5701de25f80 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 @@ -1,26 +1,10 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone', + 'backbone.marionette', './profile-activation-view', + '../../../components/common/dialogs', '../templates' -], function (ProfileActivationView) { +], function (Backbone, Marionette, ProfileActivationView, confirmDialog) { return Marionette.ItemView.extend({ tagName: 'tr', @@ -65,9 +49,9 @@ define([ revert: function () { var that = this, ruleKey = this.options.rule.get('key'); - window.confirmDialog({ - title: t('coding_rules.revert_to_parent_definition'), - html: tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name), + confirmDialog({ + title: window.t('coding_rules.revert_to_parent_definition'), + html: window.tp('coding_rules.revert_to_parent_definition.confirm', this.getParent().name), yesHandler: function () { return jQuery.ajax({ type: 'POST', @@ -87,9 +71,9 @@ define([ deactivate: function () { var that = this, ruleKey = this.options.rule.get('key'); - window.confirmDialog({ - title: t('coding_rules.deactivate'), - html: tp('coding_rules.deactivate.confirm'), + confirmDialog({ + title: window.t('coding_rules.deactivate'), + html: window.tp('coding_rules.deactivate.confirm'), yesHandler: function () { return jQuery.ajax({ type: 'POST', 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 fc7662e5073..562f349939a 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 @@ -1,27 +1,9 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone.marionette', './rule-profile-view', './profile-activation-view', '../templates' -], function (ProfileView, ProfileActivationView) { +], function (Marionette, ProfileView, ProfileActivationView) { return Marionette.CompositeView.extend({ template: Templates['coding-rules-rule-profiles'], diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js index 2aefada2578..20b4f0f4b3f 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-empty-view.js @@ -1,29 +1,12 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -define(function () { +define([ + 'backbone.marionette' +], function (Marionette) { return Marionette.ItemView.extend({ className: 'search-navigator-no-results', template: function () { - return t('coding_rules.no_results'); + return window.t('coding_rules.no_results'); } }); 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 1041a326de9..f3c8de7de57 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,28 +1,11 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ define([ + 'backbone', 'components/navigator/workspace-list-item-view', './rule/profile-activation-view', + '../../components/common/dialogs', './rule/rule-filter-mixin', './templates' -], function (WorkspaceListItemView, ProfileActivationView, RuleFilterMixin) { +], function (Backbone, WorkspaceListItemView, ProfileActivationView, confirmDialog, RuleFilterMixin) { return WorkspaceListItemView.extend(RuleFilterMixin).extend({ className: 'coding-rule', @@ -78,9 +61,9 @@ define([ var that = this, ruleKey = this.model.get('key'), activation = this.model.get('activation'); - window.confirmDialog({ - title: t('coding_rules.deactivate'), - html: tp('coding_rules.deactivate.confirm'), + confirmDialog({ + title: window.t('coding_rules.deactivate'), + html: window.tp('coding_rules.deactivate.confirm'), yesHandler: function () { return jQuery.ajax({ type: 'POST', |