3 'common/handlebars-extensions'
8 class CodingRulesDetailQualityProfilesView extends Marionette.ItemView
9 className: 'coding-rules-detail-quality-profile'
10 template: getTemplate '#coding-rules-detail-quality-profile-template'
14 severitySelect: '.coding-rules-detail-quality-profile-severity'
16 note: '.coding-rules-detail-quality-profile-note'
17 noteForm: '.coding-rules-detail-quality-profile-note-form'
18 noteText: '.coding-rules-detail-quality-profile-note-text'
19 noteAdd: '.coding-rules-detail-quality-profile-note-add'
20 noteEdit: '.coding-rules-detail-quality-profile-note-edit'
21 noteDelete: '.coding-rules-detail-quality-profile-note-delete'
22 noteCancel: '.coding-rules-detail-quality-profile-note-cancel'
23 noteSubmit: '.coding-rules-detail-quality-profile-note-submit'
27 'click @ui.noteAdd': 'editNote'
28 'click @ui.noteEdit': 'editNote'
29 'click @ui.noteDelete': 'deleteNote'
30 'click @ui.noteCancel': 'cancelNote'
31 'click @ui.noteSubmit': 'submitNote'
53 @ui.note.html '<i class="spinner"></i>'
54 @ui.noteForm.html '<i class="spinner"></i>'
57 url: "#{baseUrl}/api/codingrules/note"
59 data: text: @ui.noteText.val()
61 @model.set 'note', r.note
69 return state.text unless state.id
70 "<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
72 @ui.severitySelect.val @model.get 'severity'
73 @ui.severitySelect.select2
75 minimumResultsForSearch: 999
77 formatSelection: format
78 escapeMarkup: (m) -> m
82 return null unless @model.get 'inherits'
83 @options.qualityProfiles.findWhere(key: @model.get('inherits')).toJSON()
88 parameters = @model.get 'parameters'
89 return parameters unless parent
91 _.extend p, original: _.findWhere(parent.parameters, key: p.key).value
97 parameters: @enhanceParameters()
98 severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']