From: Stas Vilchik Date: Fri, 25 Mar 2016 10:14:28 +0000 (+0100) Subject: MMF-223 clean up X-Git-Tag: 5.5-M12~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=66e51209252064e2528825895d8f9e391332e727;p=sonarqube.git MMF-223 clean up --- 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 282c5dd1cc7..813d04b1af6 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 @@ -31,7 +31,6 @@ import WorkspaceListView from './workspace-list-view'; import WorkspaceHeaderView from './workspace-header-view'; import FacetsView from './facets-view'; import FiltersView from './filters-view'; -import { translate } from '../../helpers/l10n'; const App = new Marionette.Application(); const init = 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 8f783009933..d89f9ab0661 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 @@ -17,16 +17,9 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import _ from 'underscore'; import Marionette from 'backbone.marionette'; import Template from './templates/coding-rules-filters.hbs'; export default Marionette.ItemView.extend({ - template: Template, - - serializeData () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - canWrite: this.options.app.canWrite - }); - } + template: Template }); 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 e788c19cef2..dc4665ee3a5 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 @@ -154,7 +154,7 @@ export default Marionette.LayoutView.extend({ serializeData () { const isCustom = this.model.has('templateKey'); - const isEditable = this.options.app.canWrite && (isCustom); + const isEditable = this.options.app.canWrite && isCustom; let qualityProfilesVisible = true; if (this.model.get('isTemplate')) { 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 9ed27e3238f..9c5c5df3bf8 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 @@ -93,7 +93,7 @@ export default Marionette.ItemView.extend({ }, serializeData () { - const isEditable = this.options.app.canWrite && (this.model.get('isCustom')); + const isEditable = this.options.app.canWrite && this.model.get('isCustom'); return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { isEditable, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs index 57503382826..33919a00353 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-meta.hbs @@ -52,8 +52,8 @@
  • {{t 'coding_rules.available_since'}} {{d createdAt}}
  • - {{repoName}}({{langName}}) + data-toggle="tooltip" data-placement="bottom" title="Rule repository (language)"> + {{repoName}} ({{langName}})
  • {{#if isTemplate}} diff --git a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js b/server/sonar-web/src/main/js/components/issue/manual-issue-view.js deleted file mode 100644 index bd971c2222a..00000000000 --- a/server/sonar-web/src/main/js/components/issue/manual-issue-view.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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. - */ -import $ from 'jquery'; -import _ from 'underscore'; -import Marionette from 'backbone.marionette'; -import Issue from './models/issue'; -import Template from './templates/manual-issue.hbs'; - -export default Marionette.ItemView.extend({ - template: Template, - - events: { - 'submit .js-manual-issue-form': 'formSubmit', - 'click .js-cancel': 'cancel' - }, - - initialize () { - const that = this; - this.rules = []; - $.get('/api/rules/search?repositories=manual&f=name&ps=9999999').done(function (r) { - that.rules = r.rules; - that.render(); - }); - }, - - onRender () { - this.delegateEvents(); - this.$('[name=rule]').select2({ - width: '250px', - minimumResultsForSearch: 10 - }); - if (this.rules.length > 0) { - this.$('[name=rule]').select2('open'); - } - if (key != null) { - this.key = key.getScope(); - key.setScope(''); - } - }, - - onDestroy () { - if (key != null && this.key != null) { - key.setScope(this.key); - } - }, - - formSubmit (e) { - const that = this; - e.preventDefault(); - const issue = new Issue({ - component: this.options.component, - line: this.options.line, - message: this.$('[name="message"]').val(), - rule: this.$('[name="rule"]').val() - }); - issue.save().done(function () { - that.addIssue(issue); - }); - }, - - addIssue (issue) { - const that = this; - return issue.fetch().done(function () { - that.trigger('add', issue); - that.destroy(); - }); - }, - - cancel (e) { - e.preventDefault(); - this.destroy(); - }, - - serializeData () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - rules: _.sortBy(this.rules, 'name') - }); - } -}); - - diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js index dad2d571b65..acb9b46be42 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/line-actions-popup.js @@ -29,8 +29,7 @@ export default Popup.extend({ getPermalink (e) { e.preventDefault(); - const url = '/component/index?id=' + - (encodeURIComponent(this.model.key())) + '&line=' + this.options.line; + const url = `/component/index?id=${encodeURIComponent(this.model.key())}&line=${this.options.line}`; const windowParams = 'resizable=1,scrollbars=1,status=1'; window.open(url, this.model.get('name'), windowParams); }