1 // Generated by CoffeeScript 1.6.3
3 var __hasProp = {}.hasOwnProperty,
4 __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
6 define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) {
7 var CodingRulesQualityProfileActivationView, _ref;
8 return CodingRulesQualityProfileActivationView = (function(_super) {
9 __extends(CodingRulesQualityProfileActivationView, _super);
11 function CodingRulesQualityProfileActivationView() {
12 _ref = CodingRulesQualityProfileActivationView.__super__.constructor.apply(this, arguments);
16 CodingRulesQualityProfileActivationView.prototype.className = 'modal';
18 CodingRulesQualityProfileActivationView.prototype.template = getTemplate('#coding-rules-quality-profile-activation-template');
20 CodingRulesQualityProfileActivationView.prototype.ui = {
21 qualityProfileSelect: '#coding-rules-quality-profile-activation-select',
22 qualityProfileSeverity: '#coding-rules-quality-profile-activation-severity',
23 qualityProfileActivate: '#coding-rules-quality-profile-activation-activate'
26 CodingRulesQualityProfileActivationView.prototype.events = {
27 'click #coding-rules-quality-profile-activation-cancel': 'hide',
28 'click @ui.qualityProfileActivate': 'activate'
31 CodingRulesQualityProfileActivationView.prototype.activate = function() {
33 this.$('.modal-foot').html('<i class="spinner"></i>');
36 url: "" + baseUrl + "/api/codingrules/activate",
41 jQuery('.navigator-results-list .active').click();
46 CodingRulesQualityProfileActivationView.prototype.onRender = function() {
49 dialogClass: 'no-close',
58 this.ui.qualityProfileSelect.select2({
60 minimumResultsForSearch: 5
62 format = function(state) {
66 return "<i class='icon-severity-" + (state.id.toLowerCase()) + "'></i> " + state.text;
68 this.ui.qualityProfileSeverity.val(this.model.get('severity'));
69 return this.ui.qualityProfileSeverity.select2({
71 minimumResultsForSearch: 999,
73 formatSelection: format
77 CodingRulesQualityProfileActivationView.prototype.show = function() {
79 return this.$el.dialog('open');
82 CodingRulesQualityProfileActivationView.prototype.hide = function() {
83 return this.$el.dialog('close');
86 CodingRulesQualityProfileActivationView.prototype.getAvailableQualityProfiles = function() {
88 return _.reject(this.options.app.qualityProfiles, function(profile) {
89 return _.findWhere(_this.model.get('qualityProfiles'), {
95 CodingRulesQualityProfileActivationView.prototype.serializeData = function() {
96 return _.extend(CodingRulesQualityProfileActivationView.__super__.serializeData.apply(this, arguments), {
97 qualityProfiles: this.getAvailableQualityProfiles(),
98 severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
102 return CodingRulesQualityProfileActivationView;
104 })(Marionette.ItemView);