serializeData: ->
languages = @options.app.languageFilter.get('value')
- activation = @options.app.activationFilter.get('value')
- qualityProfile: @options.app.getQualityProfile()
+ activationValues = @options.app.activationFilter.get('value') or []
+ qualityProfile = @options.app.getQualityProfile()
+
+ qualityProfile: qualityProfile
qualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
- singleLanguage: _.isArray(languages) && languages.length == 1
+ singleLanguage: _.isArray(languages) and languages.length == 1
language: @options.app.languageFilter.view.renderValue()
- activation: activation && activation.length == 1 && activation[0]
+ allowActivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'false')
+ allowDeactivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'true')
+ allowChangeSeverity: qualityProfile and activationValues.length > 0 and activationValues[0] == 'true'
@model.trigger 'change:enabled'
unless @model.get 'value'
@choices.each (model) -> model.set 'checked', model.id == 'true'
- @model.set 'value', [true]
+ @model.set 'value', ['true']
@$el.removeClass('navigator-filter-inactive').prop 'title', ''
@options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
@hideDetails()
{{! activation }}
-{{#notEq activation 'false'}}
- <a class="coding-rules-bulk-change-dropdown-link" data-action="activate">
- {{t 'coding_rules.activate_in'}}
- </a>
-{{/notEq}}
+<a class="coding-rules-bulk-change-dropdown-link" data-action="activate">
+ {{t 'coding_rules.activate_in'}}…
+</a>
-{{#eq activation 'false'}}
+{{#if allowActivateOnProfile}}
<a class="coding-rules-bulk-change-dropdown-link" data-action="activate" data-param="{{qualityProfile}}">
{{t 'coding_rules.activate_in'}} <strong>{{qualityProfileName}}</strong>
</a>
-{{/eq}}
+{{/if}}
{{! deactivation }}
-{{#notEq activation 'true'}}
- <a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate">
- {{t 'coding_rules.deactivate_in'}}
- </a>
-{{/notEq}}
+<a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate">
+ {{t 'coding_rules.deactivate_in'}}…
+</a>
-{{#eq activation 'true'}}
+{{#if allowDeactivateOnProfile}}
<a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate" data-param="{{qualityProfile}}">
{{tp 'coding_rules.deactivate_in'}} <strong>{{qualityProfileName}}</strong>
</a>
-{{/eq}}
+{{/if}}
{{! severity }}
-{{#eq activation 'true'}}
+{{#if allowChangeSeverity}}
<a class="coding-rules-bulk-change-dropdown-link" data-action="change-severity" data-param="{{qualityProfile}}">
{{t 'coding_rules.change_severity_in'}} <strong>{{qualityProfileName}}</strong>
</a>
-{{/eq}}
+{{/if}}