events:
'submit form': 'onSubmit'
'click #coding-rules-cancel-bulk-change': 'hide'
- 'click label': 'enableAction'
'change select': 'enableAction'
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) ->
.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
<option value="{{key}}">{{name}} ({{lang}})</option>
{{/each}}
</select>
+ <input id="coding-rules-bulk-change-activate-all" type="checkbox">
+ <label class="simple-label" for="coding-rules-bulk-change-activate-all">{{t 'all'}}</label>
</div>
{{/eq}}
<option value="{{key}}">{{name}} ({{lang}})</option>
{{/each}}
</select>
+ <input id="coding-rules-bulk-change-deactivate-all" type="checkbox">
+ <label class="simple-label" for="coding-rules-bulk-change-deactivate-all">{{t 'all'}}</label>
</div>
{{/eq}}