@qualityProfilesView = new CodingRulesDetailQualityProfilesView
app: @options.app
collection: qualityProfiles
+ rule: @model
qualityProfile = @options.app.getQualityProfile()
if qualityProfile
@contextQualityProfileView = new CodingRulesDetailQualityProfileView
app: @options.app
model: @contextProfile
+ rule: @model
@listenTo @contextProfile, 'destroy', @hideContext
@model.set 'lang', @options.app.languages[@model.get 'lang']
activate: ->
+ profileKey = @ui.qualityProfileSelect.val()
+ if @model
+ profileKey = @model.get('qProfile')
+ severity = @ui.qualityProfileSeverity.val()
+
@$('.modal-foot').html '<i class="spinner"></i>'
jQuery.ajax
type: 'POST'
- url: "#{baseUrl}/api/rules/activate"
- data: id: 1
+ url: "#{baseUrl}/api/qualityprofiles/activate_rule"
+ data:
+ profile_key: profileKey
+ rule_key: @rule.get('key')
+ severity: severity
.done =>
- severity = @ui.qualityProfileSeverity.val()
parameters = @ui.qualityProfileParameters.map(->
key: jQuery(@).prop('name'), value: jQuery(@).val() || jQuery(@).prop('placeholder')).get()
if @model
@model.set severity: severity, parameters: parameters
else
- key = @ui.qualityProfileSelect.val()
model = new Backbone.Model
- name: _.findWhere(@options.app.qualityProfiles, key: key).name
- key: key
+ name: _.findWhere(@options.app.qualityProfiles, key: profileKey).name
+ key: profileKey
severity: severity
parameters: parameters
@options.app.detailView.qualityProfilesView.collection.add model
<td class="coding-rules-detail-quality-profile-actions">
<div class="button-group">
- <button class="coding-rules-detail-quality-profile-change">{{t 'change'}}</button>
+ <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
{{#if parent}}
<button class="coding-rules-detail-quality-profile-revert button-red">
{{t 'coding_rules.revert_to_parent_definition'}}
{{/if}}
</tr>
</tbody>
-</table>
\ No newline at end of file
+</table>