]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6107 Rules page is hanging when doing random clicks on Ordered By
authorStas Vilchik <vilchiks@gmail.com>
Wed, 28 Jan 2015 14:36:18 +0000 (15:36 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 28 Jan 2015 14:36:18 +0000 (15:36 +0100)
server/sonar-web/src/main/coffee/coding-rules/app.coffee
server/sonar-web/src/main/coffee/coding-rules/views/actions-view.coffee
server/sonar-web/src/main/hbs/coding-rules/coding-rules-actions.hbs

index 953c00910805a1385ef1bd9ede8c66dfb94ff2b6..cbf690fdbd06caa88e8c122211face88bd9885b4 100644 (file)
@@ -119,7 +119,7 @@ requirejs [
     sort = _.findWhere(params, key: 'sort')
     asc = _.findWhere(params, key: 'asc')
 
-    if (sort && asc)
+    if (sort? && asc?)
       @codingRules.sorting =
         sort: sort.value
         asc: asc.value =='true'
index b5f13553de5d4405ee023346ab917091bed9d87a..badb62f19b7d8c0e738534665395be74a13d1225 100644 (file)
@@ -21,15 +21,14 @@ define [
 
     events:
       'click .navigator-actions-order': 'toggleOrderChoices'
-      'click @ui.orderChoices': 'sort'
+      'click .navigator-actions-order-choices li': 'sort'
       'click @ui.bulkChange': 'bulkChange'
 
 
     onRender: ->
       unless @collection.sorting.sortText
-        while not @collection.sorting.sortText
-          @collection.sorting.sortText = @$('[data-sort=' + @collection.sorting.sort + ']:first').text()
-        @render()
+        @collection.sorting.sortText = @$("[data-sort=#{@collection.sorting.sort}]:first").text()
+        @$('.navigator-actions-ordered-by').text @collection.sorting.sortText
 
 
     toggleOrderChoices: (e) ->
@@ -44,10 +43,10 @@ define [
       e.stopPropagation()
       @ui.orderChoices.removeClass 'open'
       jQuery('body').off 'click.coding_rules_actions'
-      el = jQuery(e.target)
+      el = jQuery(e.currentTarget)
       sort = el.data 'sort'
       asc = el.data 'asc'
-      if sort != null && asc != null
+      if sort? && asc?
         @collection.sorting = sort: sort, sortText: el.text(), asc: asc
         @options.app.fetchFirstPage()
 
index 2b3d0764b934d067f58056e4dada3443051095ba..c18a32dc06e9db6944aa004d40db674fab08fde5 100644 (file)
@@ -1,6 +1,6 @@
 <div class="navigator-actions-order">
   {{#if sorting}}
-    {{t 'coding_rules.ordered_by'}} <strong>{{sorting.sortText}}</strong> {{#if sorting.asc}}<i class="icon-sort-asc"></i>{{else}}<i class="icon-sort-desc"></i>{{/if}}
+    {{t 'coding_rules.ordered_by'}} <strong class="navigator-actions-ordered-by">{{sorting.sortText}}</strong> {{#if sorting.asc}}<i class="icon-sort-asc"></i>{{else}}<i class="icon-sort-desc"></i>{{/if}}
   {{else}}
     {{t 'coding_rules.order'}}
   {{/if}}