coding_rules.extend_description=Extend Description
coding_rules.deactivate_in=Deactivate In
coding_rules.deactivate=Deactivate
+coding_rules.deactivate.confirm=Are you sure you want to deactivate this rule in profile {0}?
coding_rules.deactivate_in_quality_profile=Deactivate In Quality Profile
coding_rules.deactivate_in_all_quality_profiles=Deactivate In All {0} Profiles
coding_rules.found=Found
coding_rules.remove_extended_description.confirm=Are you sure you want to remove the extended description?
coding_rules.repository=Repository:
coding_rules.revert_to_parent_definition=Revert to Parent Definition
+coding_rules.revert_to_parent_definition.confirm=This rule will be reverted to the parameters defined in profile {0}. Are you sure?
coding_rules.rule_template=Rule Template
coding_rules.rule_template.title=This rule can be used as a template to create custom rules,\nit cannot be activated on a profile
coding_rules._rules=rules
'click @ui.delete': 'delete'
delete: ->
- if confirm(t 'are_you_sure')
- origEl = @$el.html()
- @$el.html '<i class="spinner"></i>'
+ confirmDialog
+ title: t 'delete'
+ html: t 'are_you_sure'
+ yesHandler: =>
+ origEl = @$el.html()
+ @$el.html '<i class="spinner"></i>'
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/delete"
- data:
- key: @model.get 'key'
- .done =>
- templateKey = @options.templateKey or @options.templateRule.get 'key'
- @options.app.showRule templateKey
- .fail =>
- @$el.html origEl
+ jQuery.ajax
+ type: 'POST'
+ url: "#{baseUrl}/api/rules/delete"
+ data:
+ key: @model.get 'key'
+ .done =>
+ templateKey = @options.templateKey or @options.templateRule.get 'key'
+ @options.app.showRule templateKey
+ .fail =>
+ @$el.html origEl
serializeData: ->
_.extend super,
revert: ->
ruleKey = @options.rule.get('key')
- if confirm t 'are_you_sure'
- that = @
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/activate_rule"
- data:
+ confirmDialog
+ title: t 'coding_rules.revert_to_parent_definition'
+ html: tp 'coding_rules.revert_to_parent_definition.confirm', @getParent().name
+ yesHandler: =>
+ jQuery.ajax
+ type: 'POST'
+ url: "#{baseUrl}/api/qualityprofiles/activate_rule"
+ data:
profile_key: @model.get('qProfile')
rule_key: ruleKey
reset: true
- .done =>
- @options.app.showRule ruleKey
+ .done =>
+ @options.app.showRule ruleKey
deactivate: ->
ruleKey = @options.rule.get('key')
- if confirm t 'are_you_sure'
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/deactivate_rule"
- data:
- profile_key: @model.get('qProfile')
- rule_key: ruleKey
- .done =>
- @options.app.showRule ruleKey
+ myProfile = _.findWhere(@options.app.qualityProfiles, key: @model.get('qProfile'))
+ confirmDialog
+ title: t 'coding_rules.deactivate'
+ html: tp 'coding_rules.deactivate.confirm', myProfile.name
+ yesHandler: =>
+ jQuery.ajax
+ type: 'POST'
+ url: "#{baseUrl}/api/qualityprofiles/deactivate_rule"
+ data:
+ profile_key: @model.get('qProfile')
+ rule_key: ruleKey
+ .done =>
+ @options.app.showRule ruleKey
enableUpdate: ->
removeExtendedDescription: ->
- if confirm(t 'coding_rules.remove_extended_description.confirm')
- @ui.extendDescriptionText.val ''
- @submitExtendDescription()
+ confirmDialog
+ html: t 'coding_rules.remove_extended_description.confirm'
+ yesHandler: =>
+ @ui.extendDescriptionText.val ''
+ @submitExtendDescription()
activateQualityProfile: ->
deleteCustomRule: ->
- if confirm(t 'are_you_sure')
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/delete"
- data:
- key: @model.get 'key'
- .done =>
- @options.app.fetchFirstPage()
- .fail =>
- @options.app.showRule @model.get('key')
+ confirmDialog
+ title: t 'delete'
+ html: t 'are_you_sure'
+ yesHandler: =>
+ jQuery.ajax
+ type: 'POST'
+ url: "#{baseUrl}/api/rules/delete"
+ data:
+ key: @model.get 'key'
+ .done =>
+ @options.app.fetchFirstPage()
+ .fail =>
+ @options.app.showRule @model.get('key')
serializeData: ->