From: Stas Vilchik Date: Wed, 28 Jan 2015 14:36:18 +0000 (+0100) Subject: SONAR-6107 Rules page is hanging when doing random clicks on Ordered By X-Git-Tag: 4.5.3~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=573df1649ea1d99a06f91ca79de27b493a11c710;p=sonarqube.git SONAR-6107 Rules page is hanging when doing random clicks on Ordered By --- diff --git a/server/sonar-web/src/main/coffee/coding-rules/app.coffee b/server/sonar-web/src/main/coffee/coding-rules/app.coffee index 953c0091080..cbf690fdbd0 100644 --- a/server/sonar-web/src/main/coffee/coding-rules/app.coffee +++ b/server/sonar-web/src/main/coffee/coding-rules/app.coffee @@ -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' diff --git a/server/sonar-web/src/main/coffee/coding-rules/views/actions-view.coffee b/server/sonar-web/src/main/coffee/coding-rules/views/actions-view.coffee index b5f13553de5..badb62f19b7 100644 --- a/server/sonar-web/src/main/coffee/coding-rules/views/actions-view.coffee +++ b/server/sonar-web/src/main/coffee/coding-rules/views/actions-view.coffee @@ -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() diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-actions.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-actions.hbs index 2b3d0764b93..c18a32dc06e 100644 --- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-actions.hbs +++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-actions.hbs @@ -1,6 +1,6 @@