aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps/api-documentation/actions-view.js')
-rw-r--r--server/sonar-web/src/main/js/apps/api-documentation/actions-view.js78
1 files changed, 37 insertions, 41 deletions
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js b/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
index 1553c648400..d316434fe61 100644
--- a/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
+++ b/server/sonar-web/src/main/js/apps/api-documentation/actions-view.js
@@ -1,49 +1,45 @@
-define([
- './action-view'
-], function (ActionView) {
+import $ from 'jquery';
+import Marionette from 'backbone.marionette';
+import ActionView from './action-view';
- var $ = jQuery;
+export default Marionette.CollectionView.extend({
+ childView: ActionView,
- return Marionette.CollectionView.extend({
- childView: ActionView,
+ childViewOptions: function () {
+ return {
+ state: this.options.state
+ };
+ },
- childViewOptions: function () {
- return {
- state: this.options.state
- };
- },
-
- scrollToTop: function () {
- var parent = this.$el.scrollParent();
- if (parent.is(document)) {
- parent = $(window);
- }
- parent.scrollTop(0);
- },
-
- scrollToAction: function (action) {
- var model = this.collection.findWhere({ key: action });
- if (model != null) {
- var view = this.children.findByModel(model);
- if (view != null) {
- this.scrollToView(view);
- }
- }
- },
+ scrollToTop: function () {
+ var parent = this.$el.scrollParent();
+ if (parent.is(document)) {
+ parent = $(window);
+ }
+ parent.scrollTop(0);
+ },
- scrollToView: function (view) {
- var el = view.$el,
- parent = el.scrollParent();
- var elOffset = el.offset(),
- parentOffset = parent.offset();
- if (parent.is(document)) {
- parentOffset = { top: 0 };
- }
- if (elOffset != null && parentOffset != null) {
- var scrollTop = elOffset.top - parentOffset.top - 70;
- parent.scrollTop(scrollTop);
+ scrollToAction: function (action) {
+ var model = this.collection.findWhere({ key: action });
+ if (model != null) {
+ var view = this.children.findByModel(model);
+ if (view != null) {
+ this.scrollToView(view);
}
}
- });
+ },
+ scrollToView: function (view) {
+ var el = view.$el,
+ parent = el.scrollParent();
+ var elOffset = el.offset(),
+ parentOffset = parent.offset();
+ if (parent.is(document)) {
+ parentOffset = { top: 0 };
+ }
+ if (elOffset != null && parentOffset != null) {
+ var scrollTop = elOffset.top - parentOffset.top - 70;
+ parent.scrollTop(scrollTop);
+ }
+ }
});