From: Stas Vilchik Date: Tue, 25 Mar 2014 06:31:31 +0000 (+0600) Subject: SONAR-5007 Bulk action on found rules X-Git-Tag: 4.3~290 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=88683a0b5fc278840fae7ec97271368f3217066e;p=sonarqube.git SONAR-5007 Bulk action on found rules --- diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee index 3afb0615623..881b70c6293 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee @@ -16,8 +16,8 @@ define [ doAction: (e) -> - action = jQuery(e.target).data 'action' - param = jQuery(e.target).data 'param' + action = jQuery(e.currentTarget).data 'action' + param = jQuery(e.currentTarget).data 'param' unless param @options.app.codingRulesBulkChangeView.show action else diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee index dd341022c71..144cbfafb37 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee @@ -14,7 +14,6 @@ define [ events: 'submit form': 'onSubmit' 'click #coding-rules-cancel-bulk-change': 'hide' - 'click label': 'enableAction' 'change select': 'enableAction' @@ -56,10 +55,23 @@ define [ prepareQuery: -> query = @options.app.getQuery() - switch @action - when 'activate' then _.extend query, bulk_activate: @$('#coding-rules-bulk-change-activate-on').val() - when 'deactivate' then _.extend query, bulk_deactivate: @$('#coding-rules-bulk-change-deactivate-on').val() - when 'change-severity' then _.extend query, bulk_change_severity: @$('#coding-rules-bulk-change-severity').val() + + if @action == 'activate' + if @$('#coding-rules-bulk-change-activate-all').is ':checked' + _.extend query, bulk_activate: _.pluck @options.app.qualityProfiles, 'key' + else + _.extend query, bulk_activate: @$('#coding-rules-bulk-change-activate-on').val() + + if @action == 'deactivate' + if @$('#coding-rules-bulk-change-deactivate-all').is ':checked' + _.extend query, bulk_deactivate: _.pluck @options.app.qualityProfiles, 'key' + else + _.extend query, bulk_deactivate: @$('#coding-rules-bulk-change-deactivate-on').val() + + if @action == 'change-severity' + _.extend query, bulk_change_severity: @$('#coding-rules-bulk-change-severity').val() + + query bulkChange: (query) -> @@ -70,16 +82,12 @@ define [ .done => @options.app.fetchFirstPage() + onSubmit: (e) -> e.preventDefault() @bulkChange(@prepareQuery()).done => @hide() - - enableAction: (e) -> - jQuery(e.target).siblings('input[type=checkbox]').prop 'checked', true - - serializeData: -> action: @action diff --git a/sonar-server/src/main/webapp/less/style.less b/sonar-server/src/main/webapp/less/style.less index 6c1aec34cd8..28d386b2c3d 100644 --- a/sonar-server/src/main/webapp/less/style.less +++ b/sonar-server/src/main/webapp/less/style.less @@ -2460,6 +2460,16 @@ ul.modal-head-metadata li { word-wrap: break-word; position: relative; padding-top: 5px; + + &.simple-label { + display: inline-block; + vertical-align: middle; + float: none; + position: static; + margin: 0 0 0 -5px; + padding: 0; + text-align: left; + } } .modal-field input { diff --git a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs index ff7157676cf..0e3c9e7d54c 100644 --- a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs +++ b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs @@ -22,6 +22,8 @@ {{/each}} + + {{/eq}} @@ -33,6 +35,8 @@ {{/each}} + + {{/eq}}