From: Stas Vilchik Date: Tue, 4 Feb 2014 10:26:20 +0000 (+0600) Subject: New Issues Page: if an issue is at file level, display 30 lines of source code below X-Git-Tag: 4.2~276 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0e0950c9d5b2ec4b08747d2b1f380fc98972c9ce;p=sonarqube.git New Issues Page: if an issue is at file level, display 30 lines of source code below --- diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues.js b/sonar-server/src/main/webapp/javascripts/navigator/issues.js index 5d39841af3a..a00409cd8e7 100644 --- a/sonar-server/src/main/webapp/javascripts/navigator/issues.js +++ b/sonar-server/src/main/webapp/javascripts/navigator/issues.js @@ -176,25 +176,19 @@ jQuery(function() { }); jQuery('.navigator-details').empty().addClass('navigator-fetching'); - if (this.model.get('line')) { - jQuery.when(detailView.model.fetch()).done(function() { - that.fetchSource(detailView, function() { - jQuery('.navigator-details').removeClass('navigator-fetching'); - app.detailsRegion.show(detailView); - }); - }); - } else { - jQuery.when(detailView.model.fetch()).done(function() { + jQuery.when(detailView.model.fetch()).done(function() { + that.fetchSource(detailView, function() { jQuery('.navigator-details').removeClass('navigator-fetching'); app.detailsRegion.show(detailView); }); - } + }); }, fetchSource: function (view, callback) { - var from = this.model.get('line') - 10, - to = this.model.get('line') + 30; + var line = this.model.get('line') || 0, + from = line >= 10 ? line - 10 : 0, + to = line + 30; return jQuery .ajax({ @@ -202,7 +196,7 @@ jQuery(function() { url: baseUrl + '/api/sources/show', data: { key: this.model.get('component'), - from: from >= 0 ? from : 0, + from: from, to: to, format: 'json' }