'edit': 'Edit'
'markdown.helplink': 'Markdown Help'
'moreCriteria': '+ More Criteria'
+ 'save': 'Save'
'search_verb': 'Search'
'severity': 'Severity'
'update': 'Update'
'coding_rules.bulk_change': 'Bulk Change'
'coding_rules.change_severity': 'Change Severity'
'coding_rules.change_severity_in': 'Change Severity In'
+ 'coding_rules.change_details': 'Change Details of Quality Profile'
'coding_rules.extend_description': 'Extend Description'
'coding_rules.deactivate_in': 'Deactivate In'
'coding_rules.deactivate': 'Deactivate'
key: 'S1190'
parameters: [
{ key: 'someParameter', type: 'INT', default: 4, description: 'Some parameter description' }
- { key: 'boolParameter', type: 'BOOL', description: 'Bool parameter description' }
]
description: '''
<p>
Templates
) ->
- class CodingRulesDetailQualityProfilesView extends Marionette.ItemView
+ class CodingRulesDetailQualityProfileView extends Marionette.ItemView
className: 'coding-rules-detail-quality-profile'
template: Templates['coding-rules-detail-quality-profile']
change: '.coding-rules-detail-quality-profile-change'
+ events:
+ 'click @ui.change': 'change'
+
+
+ change: ->
+ @options.app.codingRulesQualityProfileActivationView.model = @model
+ @options.app.codingRulesQualityProfileActivationView.show()
+
+
enableUpdate: ->
@ui.update.prop 'disabled', false
itemView: CodingRulesDetailQualityProfileView
itemViewOptions: ->
+ app: @options.app
qualityProfiles: @collection
\ No newline at end of file
extendDescriptionSpinner: '#coding-rules-detail-extend-description-spinner'
cancelExtendDescription: '#coding-rules-detail-extend-description-cancel'
- qualityProfileActivate: '#coding-rules-quality-profile-activate'
+ activateQualityProfile: '#coding-rules-quality-profile-activate'
+ changeQualityProfile: '.coding-rules-detail-quality-profile-update'
events:
'click @ui.cancelExtendDescription': 'hideExtendDescriptionForm'
'click @ui.extendDescriptionSubmit': 'submitExtendDescription'
- 'click @ui.qualityProfileActivate': 'activateQualityProfile'
+ 'click @ui.activateQualityProfile': 'activateQualityProfile'
+ 'click @ui.changeQualityProfile': 'changeQualityProfile'
initialize: (options) ->
@qualityProfilesView = new CodingRulesDetailQualityProfilesView
+ app: @options.app
collection: new Backbone.Collection options.model.get 'qualityProfiles'
@render()
+ getContextQualilyProfile: ->
+ contextQualityProfile = @options.app.getQualityProfile()
+ _.findWhere @model.get('qualityProfiles'), key: contextQualityProfile
+
+
activateQualityProfile: ->
- @options.app.codingRulesQualityProfileActivationView.model = @model
+ @options.app.codingRulesQualityProfileActivationView.model = null
+ @options.app.codingRulesQualityProfileActivationView.show()
+
+
+ changeQualityProfile: ->
+ @options.app.codingRulesQualityProfileActivationView.model = new Backbone.Model @getContextQualilyProfile()
@options.app.codingRulesQualityProfileActivationView.show()
serializeData: ->
contextQualityProfile = @options.app.getQualityProfile()
- qualityProfile = _.findWhere @model.get('qualityProfiles'), key: contextQualityProfile
_.extend super,
contextQualityProfile: contextQualityProfile
contextQualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
- qualityProfile: qualityProfile
\ No newline at end of file
+ qualityProfile: @getContextQualilyProfile()
\ No newline at end of file
url: "#{baseUrl}/api/codingrules/show"
.done (r) =>
@model.set r.codingrule
+ @options.app.codingRulesQualityProfileActivationView.rule = @model
detailView = new CodingRulesDetailView
app: @options.app
model: @model
return state.text unless state.id
"<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
- @ui.qualityProfileSeverity.val @model.get 'severity'
+ severity = if @model then @model.get 'severity' else @rule.get 'severity'
+ @ui.qualityProfileSeverity.val severity
@ui.qualityProfileSeverity.select2
width: '250px'
minimumResultsForSearch: 999
getAvailableQualityProfiles: ->
_.reject @options.app.qualityProfiles, (profile) =>
- _.findWhere @model.get('qualityProfiles'), key: profile.key
+ _.findWhere @rule.get('qualityProfiles'), key: profile.key
serializeData: ->
+ parameters = if @model then @model.get('parameters') else @rule.get('parameters')
+
_.extend super,
+ rule: @rule.toJSON()
+ parameters: parameters
qualityProfiles: @getAvailableQualityProfiles()
severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
<form>
<div class="modal-head">
- <h2>{{t 'coding_rules.activate_in_quality_profile'}}</h2>
+ {{#if key}}
+ <h2>{{t 'coding_rules.change_details'}}</h2>
+ {{else}}
+ <h2>{{t 'coding_rules.activate_in_quality_profile'}}</h2>
+ {{/if}}
</div>
<div class="modal-body">
<tr class="property">
<th><h3>{{t 'coding_rules.quality_profile'}}</h3></th>
<td>
- <select id="coding-rules-quality-profile-activation-select">
- {{#each qualityProfiles}}
- <option value="{{key}}">{{name}}</option>
- {{/each}}
- </select>
+ {{#if key}}
+ {{name}}
+ {{else}}
+ <select id="coding-rules-quality-profile-activation-select">
+ {{#each qualityProfiles}}
+ <option value="{{key}}">{{name}}</option>
+ {{/each}}
+ </select>
+ {{/if}}
</td>
</tr>
<tr class="property">
<tr class="property">
<th><h3>{{key}}</h3></th>
<td>
- <input type="text" {{#if default}}value="{{default}}"{{/if}}>
+ <input type="text" value="{{value}}" placeholder="{{default}}">
<div class="note">{{description}}</div>
{{#if extra}}
<div class="note">{{extra}}</div>
</div>
<div class="modal-foot">
- <button id="coding-rules-quality-profile-activation-activate">{{t 'coding_rules.activate'}}</button>
+ <button id="coding-rules-quality-profile-activation-activate">
+ {{#if key}}{{t 'save'}}{{else}}{{t 'coding_rules.activate'}}{{/if}}
+ </button>
<a id="coding-rules-quality-profile-activation-cancel" class="action">{{t 'cancel'}}</a>
</div>
</form>
\ No newline at end of file