From a09bbbc8d18d41f82cb51d0fceb28d24ffd4d1b5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 11 Jun 2014 10:18:39 +0200 Subject: [PATCH] SONAR-5134 Fix up/down navigation, clean spinner display --- .../src/main/coffee/coding-rules/app.coffee | 16 ++++++++++------ .../src/main/coffee/coding-rules/layout.coffee | 4 ++-- .../views/coding-rules-list-view.coffee | 15 ++++++++------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/sonar-server/src/main/coffee/coding-rules/app.coffee b/sonar-server/src/main/coffee/coding-rules/app.coffee index aab11900a3c..7c8aa97cb2e 100644 --- a/sonar-server/src/main/coffee/coding-rules/app.coffee +++ b/sonar-server/src/main/coffee/coding-rules/app.coffee @@ -160,11 +160,10 @@ requirejs [ else scrollOffset = 0 - if firstPage - @layout.showSpinner 'resultsRegion' - #else - # @layout.showSpinner 'resultsRegion' + @layout.showSpinner 'resultsRegion' @layout.showSpinner 'facetsRegion' unless fromFacets || !firstPage + + jQuery.ajax url: "#{baseUrl}/api/rules/search" data: fetchQuery @@ -178,16 +177,21 @@ requirejs [ pageIndex: r.p pageSize: r.ps pages: 1 + (r.total / r.ps) + + if @codingRulesListView + @codingRulesListView.close() + if firstPage @codingRules.reset r.rules @codingRulesListView = new CodingRulesListView app: @ collection: @codingRules - @layout.resultsRegion.show @codingRulesListView else @codingRulesListView.unbindEvents() @codingRules.add r.rules - @codingRulesListView.render() + + @layout.resultsRegion.show @codingRulesListView + if @codingRules.isEmpty() @layout.detailsRegion.reset() diff --git a/sonar-server/src/main/coffee/coding-rules/layout.coffee b/sonar-server/src/main/coffee/coding-rules/layout.coffee index 2e526b386e0..478c1ae4491 100644 --- a/sonar-server/src/main/coffee/coding-rules/layout.coffee +++ b/sonar-server/src/main/coffee/coding-rules/layout.coffee @@ -9,7 +9,6 @@ define [ class AppLayout extends Marionette.Layout className: 'navigator coding-rules-navigator' template: Templates['coding-rules-layout'] - spinner: '' storageKey: 'codingRulesResultsWidth' @@ -64,7 +63,8 @@ define [ showSpinner: (region) -> - @$(@[region].el).html @spinner + @[region].show new Marionette.ItemView + template: _.template('') startResize: (e) -> diff --git a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-list-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-list-view.coffee index 3dc873aecd3..51093f9124a 100644 --- a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-list-view.coffee +++ b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-list-view.coffee @@ -26,8 +26,12 @@ define [ onRender: -> - key 'up', 'list', => @selectPrev() - key 'down', 'list', => @selectNext() + key 'up', 'list', (e) => + @selectPrev() + #e.stopPropagation() + key 'down', 'list', (e) => + @selectNext() + #e.stopPropagation() $scrollEl = jQuery('.navigator-results') scrollEl = $scrollEl.get(0) @@ -38,16 +42,13 @@ define [ $scrollEl.off('scroll').on 'scroll', throttledScroll - close: -> - @unbindEvents - super + onClose: -> + @unbindEvents() unbindEvents: -> key.unbind 'up', 'list' key.unbind 'down', 'list' - scrollEl = jQuery '.navigator-results' - scrollEl.off 'scroll'; selectIssue: (el, open) -> -- 2.39.5