]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5134 Fix up/down navigation, clean spinner display
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Jun 2014 08:18:39 +0000 (10:18 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Jun 2014 08:18:39 +0000 (10:18 +0200)
sonar-server/src/main/coffee/coding-rules/app.coffee
sonar-server/src/main/coffee/coding-rules/layout.coffee
sonar-server/src/main/coffee/coding-rules/views/coding-rules-list-view.coffee

index aab11900a3c8b1261b97e61079e11ff7579e21d0..7c8aa97cb2ee87e94425ad65c2c5cf31d52741fb 100644 (file)
@@ -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()
index 2e526b386e0fcadbcf06e6a89c69633f57463a55..478c1ae449144ab73f46d69411dfccb422f4bcb6 100644 (file)
@@ -9,7 +9,6 @@ define [
   class AppLayout extends Marionette.Layout
     className: 'navigator coding-rules-navigator'
     template: Templates['coding-rules-layout']
-    spinner: '<i class="spinner"></i>'
     storageKey: 'codingRulesResultsWidth'
 
 
@@ -64,7 +63,8 @@ define [
 
 
     showSpinner: (region) ->
-      @$(@[region].el).html @spinner
+      @[region].show new Marionette.ItemView
+        template: _.template('<i class="spinner"></i>')
 
 
     startResize: (e) ->
index 3dc873aecd3c3d649b1c97ca4abb277a75affde5..51093f9124a3508646dae0fdbe77264528a5defe 100644 (file)
@@ -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) ->