3 'templates/coding-rules'
9 class CodingRulesDetailQualityProfilesView extends Marionette.ItemView
10 className: 'coding-rules-detail-quality-profile'
11 template: Templates['coding-rules-detail-quality-profile']
15 update: '.coding-rules-detail-quality-profile-update'
16 severitySelect: '.coding-rules-detail-quality-profile-severity'
18 note: '.coding-rules-detail-quality-profile-note'
19 noteForm: '.coding-rules-detail-quality-profile-note-form'
20 noteText: '.coding-rules-detail-quality-profile-note-text'
21 noteAdd: '.coding-rules-detail-quality-profile-note-add'
22 noteEdit: '.coding-rules-detail-quality-profile-note-edit'
23 noteDelete: '.coding-rules-detail-quality-profile-note-delete'
24 noteCancel: '.coding-rules-detail-quality-profile-note-cancel'
25 noteSubmit: '.coding-rules-detail-quality-profile-note-submit'
29 'click @ui.noteAdd': 'editNote'
30 'click @ui.noteEdit': 'editNote'
31 'click @ui.noteDelete': 'deleteNote'
32 'click @ui.noteCancel': 'cancelNote'
33 'click @ui.noteSubmit': 'submitNote'
35 'change .coding-rules-detail-parameters select': 'enableUpdate'
36 'keyup .coding-rules-detail-parameters input': 'enableUpdate'
58 @ui.note.html '<i class="spinner"></i>'
59 @ui.noteForm.html '<i class="spinner"></i>'
62 url: "#{baseUrl}/api/codingrules/note"
64 data: text: @ui.noteText.val()
66 @model.set 'note', r.note
71 @ui.update.prop 'disabled', false
78 return state.text unless state.id
79 "<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
81 @ui.severitySelect.val @model.get 'severity'
82 @ui.severitySelect.select2
84 minimumResultsForSearch: 999
86 formatSelection: format
87 escapeMarkup: (m) -> m
91 return null unless @model.get 'inherits'
92 @options.qualityProfiles.findWhere(key: @model.get('inherits')).toJSON()
97 parameters = @model.get 'parameters'
98 return parameters unless parent
100 _.extend p, original: _.findWhere(parent.parameters, key: p.key).value
106 parameters: @enhanceParameters()
107 severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']