diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-02 15:51:15 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-14 10:28:59 +0200 |
commit | 15b2160babc5c35ede960b7d0e133acbec8c6c51 (patch) | |
tree | 6475ad0602bbe4d6dae895aae43d331726ab8c33 /server/sonar-web/src/main/js/components | |
parent | e51e9c9eb0145ea5e9d40453554c456585b79936 (diff) | |
download | sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.tar.gz sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.zip |
improve the web build system, introduce gulp and browserify
Diffstat (limited to 'server/sonar-web/src/main/js/components')
50 files changed, 121 insertions, 118 deletions
diff --git a/server/sonar-web/src/main/js/components/common/action-options-view.js b/server/sonar-web/src/main/js/components/common/action-options-view.js index 061d3dffd7f..19e13e7e4e5 100644 --- a/server/sonar-web/src/main/js/components/common/action-options-view.js +++ b/server/sonar-web/src/main/js/components/common/action-options-view.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import PopupView from 'components/common/popup'; +import PopupView from './popup'; export default PopupView.extend({ className: 'bubble-popup bubble-popup-menu', diff --git a/server/sonar-web/src/main/js/components/common/modal-form.js b/server/sonar-web/src/main/js/components/common/modal-form.js index 86ae8b89387..418083b0d61 100644 --- a/server/sonar-web/src/main/js/components/common/modal-form.js +++ b/server/sonar-web/src/main/js/components/common/modal-form.js @@ -1,5 +1,5 @@ import _ from 'underscore'; -import ModalView from 'components/common/modals'; +import ModalView from './modals'; export default ModalView.extend({ diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js index 12ff93c00ba..5b974d80ba4 100644 --- a/server/sonar-web/src/main/js/components/issue/issue-view.js +++ b/server/sonar-web/src/main/js/components/issue/issue-view.js @@ -12,12 +12,12 @@ import PlanFormView from './views/plan-form-view'; import SetSeverityFormView from './views/set-severity-form-view'; import MoreActionsView from './views/more-actions-view'; import TagsFormView from './views/tags-form-view'; -import Workspace from 'components/workspace/main'; -import './templates'; +import Workspace from '../workspace/main'; +import Template from './templates/issue.hbs'; export default Marionette.ItemView.extend({ className: 'issue', - template: Templates.issue, + template: Template, modelEvents: { 'change': 'render', @@ -206,8 +206,7 @@ export default Marionette.ItemView.extend({ showRule: function () { var ruleKey = this.model.get('rule'); - var RealWorkspace = Workspace.openComponent ? Workspace : require('components/workspace/main'); - RealWorkspace.openRule({ key: ruleKey }); + Workspace.openRule({ key: ruleKey }); }, showMoreActions: function (e) { 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 index 31b318a4ac8..cf198aebd4e 100644 --- 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 @@ -2,10 +2,10 @@ import $ from 'jquery'; import _ from 'underscore'; import Marionette from 'backbone.marionette'; import Issue from './models/issue'; -import './templates'; +import Template from './templates/manual-issue.hbs'; export default Marionette.ItemView.extend({ - template: Templates['manual-issue'], + template: Template, events: { 'submit .js-manual-issue-form': 'formSubmit', diff --git a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js index b99d8ab8e90..e732493b89a 100644 --- a/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/assign-form-view.js @@ -1,11 +1,12 @@ import $ from 'jquery'; import _ from 'underscore'; -import ActionOptionsView from 'components/common/action-options-view'; -import '../templates'; +import ActionOptionsView from '../../common/action-options-view'; +import Template from '../templates/issue-assign-form.hbs'; +import OptionTemplate from '../templates/issue-assign-form-option.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-assign-form'], - optionTemplate: Templates['issue-assign-form-option'], + template: Template, + optionTemplate: OptionTemplate, events: function () { return _.extend(ActionOptionsView.prototype.events.apply(this, arguments), { diff --git a/server/sonar-web/src/main/js/components/issue/views/changelog-view.js b/server/sonar-web/src/main/js/components/issue/views/changelog-view.js index f7c51f88a7f..ca431561a98 100644 --- a/server/sonar-web/src/main/js/components/issue/views/changelog-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/changelog-view.js @@ -1,9 +1,9 @@ import _ from 'underscore'; -import PopupView from 'components/common/popup'; -import '../templates'; +import PopupView from '../../common/popup'; +import Template from '../templates/issue-changelog.hbs'; export default PopupView.extend({ - template: Templates['issue-changelog'], + template: Template, collectionEvents: { 'sync': 'render' diff --git a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js index ee2f1c91e87..c1dc3cfd172 100644 --- a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js @@ -1,11 +1,11 @@ import $ from 'jquery'; import _ from 'underscore'; -import PopupView from 'components/common/popup'; -import '../templates'; +import PopupView from '../../common/popup'; +import Template from '../templates/comment-form.hbs'; export default PopupView.extend({ className: 'bubble-popup issue-comment-bubble-popup', - template: Templates['comment-form'], + template: Template, ui: { textarea: '.issue-comment-form-text textarea', diff --git a/server/sonar-web/src/main/js/components/issue/views/issue-popup.js b/server/sonar-web/src/main/js/components/issue/views/issue-popup.js index e8160c8ef66..8c03550ee5c 100644 --- a/server/sonar-web/src/main/js/components/issue/views/issue-popup.js +++ b/server/sonar-web/src/main/js/components/issue/views/issue-popup.js @@ -1,4 +1,4 @@ -import PopupView from 'components/common/popup'; +import PopupView from '../../common/popup'; export default PopupView.extend({ className: 'bubble-popup issue-bubble-popup', diff --git a/server/sonar-web/src/main/js/components/issue/views/more-actions-view.js b/server/sonar-web/src/main/js/components/issue/views/more-actions-view.js index 70db7c1b2e4..e3f62b08e10 100644 --- a/server/sonar-web/src/main/js/components/issue/views/more-actions-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/more-actions-view.js @@ -1,9 +1,9 @@ import $ from 'jquery'; -import ActionOptionsView from 'components/common/action-options-view'; -import '../templates'; +import ActionOptionsView from '../../../components/common/action-options-view'; +import Template from '../templates/issue-more-actions.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-more-actions'], + template: Template, selectOption: function (e) { var action = $(e.currentTarget).data('action'); diff --git a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js b/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js index a0459ed7765..244d65e6a79 100644 --- a/server/sonar-web/src/main/js/components/issue/views/plan-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/plan-form-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 '../../common/action-options-view'; +import Template from '../templates/issue-plan-form.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-plan-form'], + template: Template, getActionPlan: function () { return this.model.get('actionPlan') || ''; diff --git a/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js b/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js index 50fd125f0d2..10ff68f86ef 100644 --- a/server/sonar-web/src/main/js/components/issue/views/set-severity-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/set-severity-form-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 '../../common/action-options-view'; +import Template from '../templates/issue-set-severity-form.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-set-severity-form'], + template: Template, getTransition: function () { return this.model.get('severity'); diff --git a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js index 9a3716841e0..9a688d9997a 100644 --- a/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/tags-form-view.js @@ -1,11 +1,12 @@ import $ from 'jquery'; import _ from 'underscore'; -import ActionOptionsView from 'components/common/action-options-view'; -import '../templates'; +import ActionOptionsView from '../../common/action-options-view'; +import Template from '../templates/issue-tags-form.hbs'; +import OptionTemplate from '../templates/issue-tags-form-option.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-tags-form'], - optionTemplate: Templates['issue-tags-form-option'], + template: Template, + optionTemplate: OptionTemplate, modelEvents: { 'change:tags': 'renderTags' diff --git a/server/sonar-web/src/main/js/components/issue/views/transitions-form-view.js b/server/sonar-web/src/main/js/components/issue/views/transitions-form-view.js index 80da2defc34..7af966c4149 100644 --- a/server/sonar-web/src/main/js/components/issue/views/transitions-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/transitions-form-view.js @@ -1,9 +1,9 @@ import $ from 'jquery'; -import ActionOptionsView from 'components/common/action-options-view'; -import '../templates'; +import ActionOptionsView from '../../common/action-options-view'; +import Template from '../templates/issue-transitions-form.hbs'; export default ActionOptionsView.extend({ - template: Templates['issue-transitions-form'], + template: Template, selectInitialOption: function () { this.makeActive(this.getOptions().first()); diff --git a/server/sonar-web/src/main/js/components/navigator/facets-view.js b/server/sonar-web/src/main/js/components/navigator/facets-view.js index 4471ca7de8b..15e8867a88d 100644 --- a/server/sonar-web/src/main/js/components/navigator/facets-view.js +++ b/server/sonar-web/src/main/js/components/navigator/facets-view.js @@ -1,5 +1,5 @@ import Marionette from 'backbone.marionette'; -import BaseFacet from 'components/navigator/facets/base-facet'; +import BaseFacet from './facets/base-facet'; export default Marionette.CollectionView.extend({ className: 'search-navigator-facets-list', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js index c97990b940f..0d2103ed7d7 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/ajax-select-filters.js @@ -3,7 +3,8 @@ import _ from 'underscore'; import Backbone from 'backbone'; import BaseFilters from './base-filters'; import ChoiceFilters from './choice-filters'; -import '../templates'; +import Template from '../templates/ajax-select-filter.hbs'; +import ListTemplate from '../templates/choice-filter-item.hbs'; var PAGE_SIZE = 100; @@ -98,8 +99,8 @@ var ComponentSuggestions = Suggestions.extend({ var AjaxSelectDetailsFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({ - template: Templates['ajax-select-filter'], - listTemplate: Templates['choice-filter-template'], + template: Template, + listTemplate: ListTemplate, searchKey: 's', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js index a0d96287987..0315e847257 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/base-filters.js @@ -2,7 +2,8 @@ import $ from 'jquery'; import _ from 'underscore'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; -import '../templates'; +import Template from '../templates/base-filter.hbs'; +import DetailsTemplate from '../templates/base-details-filter.hbs'; var Filter = Backbone.Model.extend({ @@ -22,7 +23,7 @@ var Filters = Backbone.Collection.extend({ var DetailsFilterView = Marionette.ItemView.extend({ - template: Templates['base-details-filter'], + template: DetailsTemplate, className: 'navigator-filter-details', @@ -42,7 +43,7 @@ var DetailsFilterView = Marionette.ItemView.extend({ var BaseFilterView = Marionette.ItemView.extend({ - template: Templates['base-filter'], + template: Template, className: 'navigator-filter', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js index 08152fd9388..f13fa417d45 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/checkbox-filters.js @@ -1,9 +1,9 @@ import $ from 'jquery'; import BaseFilters from './base-filters'; -import '../templates'; +import Template from '../templates/checkbox-filter.hbs'; export default BaseFilters.BaseFilterView.extend({ - template: Templates['checkbox-filter'], + template: Template, className: 'navigator-filter navigator-filter-inline', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js index e3451731d72..153cae4fc9e 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/choice-filters.js @@ -2,11 +2,12 @@ import $ from 'jquery'; import _ from 'underscore'; import Backbone from 'backbone'; import BaseFilters from './base-filters'; -import '../templates'; +import Template from '../templates/choice-filter.hbs'; +import ItemTemplate from '../templates/choice-filter-item.hbs'; var DetailsChoiceFilterView = BaseFilters.DetailsFilterView.extend({ - template: Templates['choice-filter'], - itemTemplate: Templates['choice-filter-item'], + template: Template, + itemTemplate: ItemTemplate, events: function () { diff --git a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js index fcf16bb0f0b..99933f83da3 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/favorite-filters.js @@ -2,10 +2,11 @@ import $ from 'jquery'; import _ from 'underscore'; import BaseFilters from './base-filters'; import ChoiceFilters from './choice-filters'; -import '../templates'; +import Template from '../templates/favorite-filter.hbs'; +import DetailsTemplate from '../templates/favorite-details-filter.hbs'; var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ - template: Templates['favorite-details-filter'], + template: DetailsTemplate, events: { @@ -43,7 +44,7 @@ var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({ var FavoriteFilterView = ChoiceFilters.ChoiceFilterView.extend({ - template: Templates['favorite-filter'], + template: Template, className: 'navigator-filter navigator-filter-favorite', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js index 17419cf5042..bc01032a430 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/filter-bar.js @@ -3,7 +3,6 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; import BaseFilters from './base-filters'; import MoreCriteriaFilters from './more-criteria-filters'; -import './favorite-filters'; export default Marionette.CompositeView.extend({ childViewContainer: '.navigator-filters-list', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js index 0125f3abf50..6344ab06182 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/metric-filters.js @@ -1,10 +1,10 @@ import $ from 'jquery'; import _ from 'underscore'; import BaseFilters from './base-filters'; -import '../templates'; +import Template from '../templates/metric-filter.hbs'; var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({ - template: Templates['metric-filter'], + template: Template, events: { diff --git a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js index cab8a35d67a..b83382ce979 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/more-criteria-filters.js @@ -1,10 +1,11 @@ import $ from 'jquery'; import _ from 'underscore'; import ChoiceFilters from './choice-filters'; -import '../templates'; +import Template from '../templates/more-criteria-filter.hbs'; +import DetailsTemplate from '../templates/more-criteria-details-filter.hbs'; var DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend({ - template: Templates['more-criteria-details-filter'], + template: DetailsTemplate, events: { @@ -56,7 +57,7 @@ var DetailsMoreCriteriaFilterView = ChoiceFilters.DetailsChoiceFilterView.extend var MoreCriteriaFilterView = ChoiceFilters.ChoiceFilterView.extend({ - template: Templates['more-criteria-filter'], + template: Template, className: 'navigator-filter navigator-filter-more-criteria', diff --git a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js index 6f5d9b7d8d0..5a24295f4fe 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/range-filters.js @@ -1,10 +1,10 @@ import $ from 'jquery'; import _ from 'underscore'; import BaseFilters from './base-filters'; -import '../templates'; +import Template from '../templates/range-filter.hbs'; var DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({ - template: Templates['range-filter'], + template: Template, events: { diff --git a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js index f1145c3732e..852b0cdeff5 100644 --- a/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js +++ b/server/sonar-web/src/main/js/components/navigator/filters/string-filters.js @@ -1,10 +1,10 @@ import $ from 'jquery'; import _ from 'underscore'; import BaseFilters from './base-filters'; -import '../templates'; +import Template from '../templates/string-filter.hbs'; var DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({ - template: Templates['string-filter'], + template: Template, events: { diff --git a/server/sonar-web/src/main/js/components/navigator/models/facets.js b/server/sonar-web/src/main/js/components/navigator/models/facets.js index 482783957b5..c9feae8422b 100644 --- a/server/sonar-web/src/main/js/components/navigator/models/facets.js +++ b/server/sonar-web/src/main/js/components/navigator/models/facets.js @@ -1,5 +1,5 @@ import Backbone from 'backbone'; -import Facet from 'components/navigator/models/facet'; +import Facet from './facet'; export default Backbone.Collection.extend({ model: Facet diff --git a/server/sonar-web/src/main/js/components/shared/avatar.jsx b/server/sonar-web/src/main/js/components/shared/avatar.js index 2f596bf3a0d..5060e088a00 100644 --- a/server/sonar-web/src/main/js/components/shared/avatar.jsx +++ b/server/sonar-web/src/main/js/components/shared/avatar.js @@ -1,4 +1,5 @@ import React from 'react'; +import md5 from 'blueimp-md5'; export default React.createClass({ propTypes: { @@ -11,7 +12,7 @@ export default React.createClass({ if (!shouldShowAvatar) { return null; } - const emailHash = window.md5(this.props.email || '').trim(); + const emailHash = md5.md5(this.props.email || '').trim(); const url = ('' + window.SS.lf.gravatarServerUrl) .replace('{EMAIL_MD5}', emailHash) .replace('{SIZE}', this.props.size * 2); diff --git a/server/sonar-web/src/main/js/components/shared/checkbox.jsx b/server/sonar-web/src/main/js/components/shared/checkbox.js index 633c23c8354..633c23c8354 100644 --- a/server/sonar-web/src/main/js/components/shared/checkbox.jsx +++ b/server/sonar-web/src/main/js/components/shared/checkbox.js diff --git a/server/sonar-web/src/main/js/components/shared/favorite.jsx b/server/sonar-web/src/main/js/components/shared/favorite.js index f75d03b4cb4..f75d03b4cb4 100644 --- a/server/sonar-web/src/main/js/components/shared/favorite.jsx +++ b/server/sonar-web/src/main/js/components/shared/favorite.js diff --git a/server/sonar-web/src/main/js/components/shared/list-footer.jsx b/server/sonar-web/src/main/js/components/shared/list-footer.js index 31ba9e1f0d6..31ba9e1f0d6 100644 --- a/server/sonar-web/src/main/js/components/shared/list-footer.jsx +++ b/server/sonar-web/src/main/js/components/shared/list-footer.js diff --git a/server/sonar-web/src/main/js/components/shared/pending-icon.jsx b/server/sonar-web/src/main/js/components/shared/pending-icon.js index 6749e973287..6749e973287 100644 --- a/server/sonar-web/src/main/js/components/shared/pending-icon.jsx +++ b/server/sonar-web/src/main/js/components/shared/pending-icon.js diff --git a/server/sonar-web/src/main/js/components/shared/qualifier-icon.jsx b/server/sonar-web/src/main/js/components/shared/qualifier-icon.js index e0f6e5a342d..e0f6e5a342d 100644 --- a/server/sonar-web/src/main/js/components/shared/qualifier-icon.jsx +++ b/server/sonar-web/src/main/js/components/shared/qualifier-icon.js diff --git a/server/sonar-web/src/main/js/components/shared/radio-toggle.jsx b/server/sonar-web/src/main/js/components/shared/radio-toggle.js index eca4026c69f..eca4026c69f 100644 --- a/server/sonar-web/src/main/js/components/shared/radio-toggle.jsx +++ b/server/sonar-web/src/main/js/components/shared/radio-toggle.js diff --git a/server/sonar-web/src/main/js/components/shared/severity-helper.jsx b/server/sonar-web/src/main/js/components/shared/severity-helper.js index a0e931aca2f..a0e931aca2f 100644 --- a/server/sonar-web/src/main/js/components/shared/severity-helper.jsx +++ b/server/sonar-web/src/main/js/components/shared/severity-helper.js diff --git a/server/sonar-web/src/main/js/components/shared/severity-icon.jsx b/server/sonar-web/src/main/js/components/shared/severity-icon.js index 87aec17ea7b..87aec17ea7b 100644 --- a/server/sonar-web/src/main/js/components/shared/severity-icon.jsx +++ b/server/sonar-web/src/main/js/components/shared/severity-icon.js diff --git a/server/sonar-web/src/main/js/components/shared/status-helper.jsx b/server/sonar-web/src/main/js/components/shared/status-helper.js index 033fd3ff786..033fd3ff786 100644 --- a/server/sonar-web/src/main/js/components/shared/status-helper.jsx +++ b/server/sonar-web/src/main/js/components/shared/status-helper.js diff --git a/server/sonar-web/src/main/js/components/shared/status-icon.jsx b/server/sonar-web/src/main/js/components/shared/status-icon.js index 5acd210745e..5acd210745e 100644 --- a/server/sonar-web/src/main/js/components/shared/status-icon.jsx +++ b/server/sonar-web/src/main/js/components/shared/status-icon.js diff --git a/server/sonar-web/src/main/js/components/source-viewer/header.js b/server/sonar-web/src/main/js/components/source-viewer/header.js index 5f72fb686f2..160577b115c 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/header.js +++ b/server/sonar-web/src/main/js/components/source-viewer/header.js @@ -3,12 +3,12 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; import MoreActionsView from './more-actions'; import MeasuresOverlay from './measures-overlay'; -import './templates'; +import Template from './templates/source-viewer-header.hbs'; var API_FAVORITE = baseUrl + '/api/favourites'; export default Marionette.ItemView.extend({ - template: Templates['source-viewer-header'], + template: Template, events: function () { return { diff --git a/server/sonar-web/src/main/js/components/source-viewer/helpers/code-with-issue-locations-helper.js b/server/sonar-web/src/main/js/components/source-viewer/helpers/code-with-issue-locations-helper.js index 0a1537002fd..417f98663a5 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/helpers/code-with-issue-locations-helper.js +++ b/server/sonar-web/src/main/js/components/source-viewer/helpers/code-with-issue-locations-helper.js @@ -1,4 +1,5 @@ import _ from 'underscore'; +import Handlebars from 'hbsfy/runtime'; /** * Intersect two ranges @@ -113,14 +114,13 @@ function doTheStuff (code, issueLocations, optionalClassName) { } -if (typeof Handlebars !== 'undefined') { - /** - * Handlebars helper to highlight issue locations in the source code - */ - Handlebars.registerHelper('codeWithIssueLocations', function (code, issueLocations) { - return doTheStuff(code, issueLocations); - }); -} +/** + * Handlebars helper to highlight issue locations in the source code + */ +Handlebars.registerHelper('codeWithIssueLocations', function (code, issueLocations) { + return doTheStuff(code, issueLocations); +}); + export default doTheStuff; diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js index 05a94e07e53..c9f553d7bd3 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/main.js +++ b/server/sonar-web/src/main/js/components/source-viewer/main.js @@ -3,22 +3,23 @@ import _ from 'underscore'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import Source from './source'; -import Issues from 'components/issue/collections/issues'; -import IssueView from 'components/issue/issue-view'; +import Issues from '../issue/collections/issues'; +import IssueView from '../issue/issue-view'; import HeaderView from './header'; import SCMPopupView from './popups/scm-popup'; import CoveragePopupView from './popups/coverage-popup'; import DuplicationPopupView from './popups/duplication-popup'; import LineActionsPopupView from './popups/line-actions-popup'; import highlightLocations from './helpers/code-with-issue-locations-helper'; -import './templates'; +import Template from './templates/source-viewer.hbs'; +import IssueLocationTemplate from './templates/source-viewer-issue-location.hbs'; var HIGHLIGHTED_ROW_CLASS = 'source-line-highlighted'; export default Marionette.LayoutView.extend({ className: 'source-viewer', - template: Templates['source-viewer'], - issueLocationTemplate: Templates['source-viewer-issue-location'], + template: Template, + issueLocationTemplate: IssueLocationTemplate, ISSUES_LIMIT: 3000, LINES_LIMIT: 1000, diff --git a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js index 7283eaa2a2e..9b071f6e1f9 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js +++ b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js @@ -1,11 +1,11 @@ import $ from 'jquery'; import _ from 'underscore'; -import ModalView from 'components/common/modals'; -import './templates'; +import ModalView from '../common/modals'; +import Template from './templates/source-viewer-measures.hbs'; export default ModalView.extend({ - template: Templates['source-viewer-measures'], + template: Template, testsOrder: ['ERROR', 'FAILURE', 'OK', 'SKIPPED'], initialize: function () { diff --git a/server/sonar-web/src/main/js/components/source-viewer/more-actions.js b/server/sonar-web/src/main/js/components/source-viewer/more-actions.js index 93704f062a7..0c633afcfdb 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/more-actions.js +++ b/server/sonar-web/src/main/js/components/source-viewer/more-actions.js @@ -1,12 +1,12 @@ import $ from 'jquery'; import _ from 'underscore'; import Marionette from 'backbone.marionette'; -import Workspace from 'components/workspace/main'; -import './templates'; +import Workspace from '../workspace/main'; +import Template from './templates/source-viewer-more-actions.hbs'; export default Marionette.ItemView.extend({ className: 'source-viewer-header-more-actions', - template: Templates['source-viewer-more-actions'], + template: Template, events: { 'click .js-measures': 'showMeasures', @@ -33,8 +33,7 @@ export default Marionette.ItemView.extend({ openInWorkspace: function () { var uuid = this.options.parent.model.id; - var RealWorkspace = Workspace.openComponent ? Workspace : require('components/workspace/main'); - RealWorkspace.openComponent({ uuid: uuid }); + Workspace.openComponent({ uuid: uuid }); }, showRawSource: function () { diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js index 9e3e0993ec4..1f712bdf4be 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js @@ -1,11 +1,11 @@ import $ from 'jquery'; import _ from 'underscore'; -import Popup from 'components/common/popup'; -import Workspace from 'components/workspace/main'; -import '../templates'; +import Popup from '../../common/popup'; +import Workspace from '../../workspace/main'; +import Template from '../templates/source-viewer-coverage-popup.hbs'; export default Popup.extend({ - template: Templates['source-viewer-coverage-popup'], + template: Template, events: { 'click a[data-uuid]': 'goToFile' @@ -19,8 +19,7 @@ export default Popup.extend({ goToFile: function (e) { e.stopPropagation(); var uuid = $(e.currentTarget).data('uuid'); - var RealWorkspace = Workspace.openComponent ? Workspace : require('components/workspace/main'); - RealWorkspace.openComponent({ uuid: uuid }); + Workspace.openComponent({ uuid: uuid }); }, serializeData: function () { diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/duplication-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/duplication-popup.js index 4d62ee40eb0..1220e736b96 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/duplication-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/duplication-popup.js @@ -1,11 +1,11 @@ import $ from 'jquery'; import _ from 'underscore'; -import Popup from 'components/common/popup'; -import Workspace from 'components/workspace/main'; -import '../templates'; +import Popup from '../../common/popup'; +import Workspace from '../../workspace/main'; +import Template from '../templates/source-viewer-duplication-popup.hbs'; export default Popup.extend({ - template: Templates['source-viewer-duplication-popup'], + template: Template, events: { 'click a[data-uuid]': 'goToFile' @@ -15,8 +15,7 @@ export default Popup.extend({ e.stopPropagation(); var uuid = $(e.currentTarget).data('uuid'), line = $(e.currentTarget).data('line'); - var RealWorkspace = Workspace.openComponent ? Workspace : require('components/workspace/main'); - RealWorkspace.openComponent({ uuid: uuid, line: line }); + Workspace.openComponent({ uuid: uuid, line: line }); }, serializeData: function () { 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 dc9be5637e0..961faebcbf0 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 @@ -1,9 +1,9 @@ -import Popup from 'components/common/popup'; -import ManualIssueView from 'components/issue/manual-issue-view'; -import '../templates'; +import Popup from '../../common/popup'; +import ManualIssueView from '../../issue/manual-issue-view'; +import Template from '../templates/source-viewer-line-options-popup.hbs'; export default Popup.extend({ - template: Templates['source-viewer-line-options-popup'], + template: Template, events: { 'click .js-get-permalink': 'getPermalink', diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js index d229f2e9d57..95e45483c2a 100644 --- a/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js +++ b/server/sonar-web/src/main/js/components/source-viewer/popups/scm-popup.js @@ -1,8 +1,8 @@ -import Popup from 'components/common/popup'; -import '../templates'; +import Popup from '../../common/popup'; +import Template from '../templates/source-viewer-scm-popup.hbs'; export default Popup.extend({ - template: Templates['source-viewer-scm-popup'], + template: Template, events: { 'click': 'onClick' diff --git a/server/sonar-web/src/main/js/components/workspace/views/item-view.js b/server/sonar-web/src/main/js/components/workspace/views/item-view.js index c307e69916d..a72c1a847ab 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/item-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/item-view.js @@ -1,10 +1,10 @@ import Marionette from 'backbone.marionette'; -import '../templates'; +import Template from '../templates/workspace-item.hbs'; export default Marionette.ItemView.extend({ tagName: 'li', className: 'workspace-nav-item', - template: Templates['workspace-item'], + template: Template, modelEvents: { 'change': 'render', diff --git a/server/sonar-web/src/main/js/components/workspace/views/items-view.js b/server/sonar-web/src/main/js/components/workspace/views/items-view.js index c244ff9c450..d156a765c77 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/items-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/items-view.js @@ -1,10 +1,10 @@ import Marionette from 'backbone.marionette'; import ItemView from './item-view'; -import '../templates'; +import Template from '../templates/workspace-items.hbs'; export default Marionette.CompositeView.extend({ className: 'workspace-nav', - template: Templates['workspace-items'], + template: Template, childViewContainer: '.workspace-nav-list', childView: ItemView, diff --git a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js index 6b3fd957638..a13165db550 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/rule-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/rule-view.js @@ -1,10 +1,10 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; import BaseView from './base-viewer-view'; -import '../templates'; +import Template from '../templates/workspace-rule.hbs'; export default BaseView.extend({ - template: Templates['workspace-rule'], + template: Template, onRender: function () { BaseView.prototype.onRender.apply(this, arguments); diff --git a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js index b0c03b77edd..9ed91fb6a13 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/viewer-header-view.js @@ -1,10 +1,10 @@ import $ from 'jquery'; import _ from 'underscore'; import Marionette from 'backbone.marionette'; -import '../templates'; +import Template from '../templates/workspace-viewer-header.hbs'; export default Marionette.ItemView.extend({ - template: Templates['workspace-viewer-header'], + template: Template, modelEvents: { 'change': 'render' diff --git a/server/sonar-web/src/main/js/components/workspace/views/viewer-view.js b/server/sonar-web/src/main/js/components/workspace/views/viewer-view.js index c335411693e..6e7699d68fd 100644 --- a/server/sonar-web/src/main/js/components/workspace/views/viewer-view.js +++ b/server/sonar-web/src/main/js/components/workspace/views/viewer-view.js @@ -1,9 +1,9 @@ import BaseView from './base-viewer-view'; -import SourceViewer from 'components/source-viewer/main'; -import '../templates'; +import SourceViewer from '../../source-viewer/main'; +import Template from '../templates/workspace-viewer.hbs'; export default BaseView.extend({ - template: Templates['workspace-viewer'], + template: Template, onRender: function () { BaseView.prototype.onRender.apply(this, arguments); @@ -11,9 +11,8 @@ export default BaseView.extend({ }, showViewer: function () { - var RealSourceViewer = SourceViewer.on ? SourceViewer : require('components/source-viewer/main'); var that = this, - viewer = new RealSourceViewer(), + viewer = new SourceViewer(), options = this.model.toJSON(); viewer.open(this.model.get('uuid'), { workspace: true }); viewer.on('loaded', function () { |