+++ /dev/null
-// Generated by CoffeeScript 1.6.3
-(function() {
- var __hasProp = {}.hasOwnProperty,
- __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; };
-
- define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) {
- var CodingRulesQualityProfileActivationView, _ref;
- return CodingRulesQualityProfileActivationView = (function(_super) {
- __extends(CodingRulesQualityProfileActivationView, _super);
-
- function CodingRulesQualityProfileActivationView() {
- _ref = CodingRulesQualityProfileActivationView.__super__.constructor.apply(this, arguments);
- return _ref;
- }
-
- CodingRulesQualityProfileActivationView.prototype.className = 'modal';
-
- CodingRulesQualityProfileActivationView.prototype.template = getTemplate('#coding-rules-quality-profile-activation-template');
-
- CodingRulesQualityProfileActivationView.prototype.ui = {
- qualityProfileSelect: '#coding-rules-quality-profile-activation-select',
- qualityProfileSeverity: '#coding-rules-quality-profile-activation-severity',
- qualityProfileActivate: '#coding-rules-quality-profile-activation-activate'
- };
-
- CodingRulesQualityProfileActivationView.prototype.events = {
- 'click #coding-rules-quality-profile-activation-cancel': 'hide',
- 'click @ui.qualityProfileActivate': 'activate'
- };
-
- CodingRulesQualityProfileActivationView.prototype.activate = function() {
- var _this = this;
- this.$('.modal-foot').html('<i class="spinner"></i>');
- return jQuery.ajax({
- type: 'POST',
- url: "" + baseUrl + "/api/codingrules/activate",
- data: {
- id: 1
- }
- }).done(function() {
- jQuery('.navigator-results-list .active').click();
- return _this.hide();
- });
- };
-
- CodingRulesQualityProfileActivationView.prototype.onRender = function() {
- var format;
- this.$el.dialog({
- dialogClass: 'no-close',
- width: '600px',
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- title: null
- });
- this.ui.qualityProfileSelect.select2({
- width: '250px',
- minimumResultsForSearch: 5
- });
- format = function(state) {
- if (!state.id) {
- return state.text;
- }
- return "<i class='icon-severity-" + (state.id.toLowerCase()) + "'></i> " + state.text;
- };
- this.ui.qualityProfileSeverity.val(this.model.get('severity'));
- return this.ui.qualityProfileSeverity.select2({
- width: '250px',
- minimumResultsForSearch: 999,
- formatResult: format,
- formatSelection: format
- });
- };
-
- CodingRulesQualityProfileActivationView.prototype.show = function() {
- this.render();
- return this.$el.dialog('open');
- };
-
- CodingRulesQualityProfileActivationView.prototype.hide = function() {
- return this.$el.dialog('close');
- };
-
- CodingRulesQualityProfileActivationView.prototype.getAvailableQualityProfiles = function() {
- var _this = this;
- return _.reject(this.options.app.qualityProfiles, function(profile) {
- return _.findWhere(_this.model.get('qualityProfiles'), {
- key: profile.key
- });
- });
- };
-
- CodingRulesQualityProfileActivationView.prototype.serializeData = function() {
- return _.extend(CodingRulesQualityProfileActivationView.__super__.serializeData.apply(this, arguments), {
- qualityProfiles: this.getAvailableQualityProfiles(),
- severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
- });
- };
-
- return CodingRulesQualityProfileActivationView;
-
- })(Marionette.ItemView);
- });
-
-}).call(this);