From 54cfa65a7340b9f53384401f562c9b302dc17094 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 3 Apr 2014 17:07:22 +0600 Subject: [PATCH] SONAR-5165 It should be possible to use up and down arrows to navigate through results in Issues page Debounce opening of issues --- sonar-server/src/main/js/issues/extra.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sonar-server/src/main/js/issues/extra.js b/sonar-server/src/main/js/issues/extra.js index 630952805b0..a291721ed9c 100644 --- a/sonar-server/src/main/js/issues/extra.js +++ b/sonar-server/src/main/js/issues/extra.js @@ -167,8 +167,7 @@ define( key.setScope('list'); this.options.issuesView.selected = this.$el.parent().children().index(this.$el); - this.$el.parent().children().removeClass('active'); - this.$el.addClass('active'); + this.options.issuesView.selectIssue(this.$el, false); var that = this, app = this.options.app, @@ -245,6 +244,12 @@ define( emptyView: NoIssuesView, + initialize: function() { + var openIssue = function(el) { el.click(); }; + this.openIssue = _.debounce(openIssue, 300); + }, + + itemViewOptions: function () { return { issuesView: this, @@ -253,6 +258,15 @@ define( }, + selectIssue: function(el, open) { + this.$('.active').removeClass('active'); + el.addClass('active'); + if (open) { + this.openIssue(el); + } + }, + + selectFirst: function() { this.selected = -1; this.selectNext(); @@ -269,7 +283,7 @@ define( if (bottom > containerHeight) { container.scrollTop(container.scrollTop() - containerHeight + bottom); } - child.click(); + this.selectIssue(child, true); } }, @@ -283,7 +297,7 @@ define( if (top < 0) { container.scrollTop(container.scrollTop() + top); } - child.click(); + this.selectIssue(child, true); } }, -- 2.39.5