--- /dev/null
+{{#each activeProfiles}}
+ {{severityIcon severity}}
+
+ {{#eq inherit 'OVERRIDES'}}
+ <i class="icon-inheritance" title="{{tp 'coding_rules.overrides' name parent.name}}"></i>
+ {{/eq}}
+ {{#eq inherit 'INHERITED'}}
+ <i class="icon-inheritance" title="{{tp 'coding_rules.inherits' name parent.name}}"></i>
+ {{/eq}}
+
+ {{#if ../canWrite}}
+ <div class="button-group">
+ {{#unless isTemplate}}
+ <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
+ {{/unless}}
+ {{#if parent}}
+ {{#eq inherit 'OVERRIDES'}}
+ <button class="coding-rules-detail-quality-profile-revert button-red">
+ {{t 'coding_rules.revert_to_parent_definition'}}
+ </button>
+ {{/eq}}
+ {{else}}
+ <button class="coding-rules-detail-quality-profile-deactivate button-red">
+ {{t 'coding_rules.deactivate'}}
+ </button>
+ {{/if}}
+ </div>
+ {{/if}}
+{{/each}}
-<div class="coding-rule-inner">
- <div class="coding-rule-title">
- <a class="js-rule link-no-underline">{{name}}</a>
- </div>
- <div class="coding-rule-meta">
- {{#notEq status 'READY'}}
- {{status}}
-
- {{/notEq}}
- <a class="js-lang link-no-underline" data-lang="{{lang}}">{{langName}}</a>
- {{#notEmpty tags}}
-
- <i class="icon-tags"></i>
- {{#each tags}}
- <a class="js-tag link-no-underline" data-tag="{{this}}">{{this}}</a>
- {{/each}}
- {{/notEmpty}}
- </div>
-</div>
+<table class="coding-rule-table">
+ <tr>
+ {{#if activeProfile}}
+ {{#if activeProfile.severity}}
+ <td class="coding-rule-table-meta-cell coding-rule-activation">
+ {{severityIcon activeProfile.severity}}
+ {{#eq activeProfile.inherit 'OVERRIDES'}}
+ <i class="icon-inheritance"
+ title="{{tp 'coding_rules.overrides' activeProfile.name activeProfile.parent.name}}"></i>
+ {{/eq}}
+ {{#eq activeProfile.inherit 'INHERITED'}}
+ <i class="icon-inheritance"
+ title="{{tp 'coding_rules.inherits' activeProfile.name activeProfile.parent.name}}"></i>
+ {{/eq}}
+ </td>
+ {{/if}}
+ {{/if}}
+
+ <td>
+ <div class="coding-rule-title">
+ <a class="js-rule link-no-underline">{{name}}</a>
+ </div>
+ </td>
+
+ <td class="coding-rule-table-meta-cell">
+ <div class="coding-rule-meta">
+ {{#notEq status 'READY'}}
+ {{status}}
+
+ {{/notEq}}
+ <a class="js-lang link-no-underline" data-lang="{{lang}}">{{langName}}</a>
+ {{#notEmpty tags}}
+
+ <i class="icon-tags"></i>
+ {{#each tags}}
+ <a class="js-tag link-no-underline" data-tag="{{this}}">{{this}}</a>
+ {{/each}}
+ {{/notEmpty}}
+ </div>
+ </td>
+
+ {{#if activeProfile}}
+ {{#if canWrite}}
+ <td class="coding-rule-table-meta-cell coding-rule-activation-actions">
+ <div class="button-group">
+ {{#if activeProfile.severity}}
+ {{#unless activeProfile.isTemplate}}
+ <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
+ {{/unless}}
+ {{#if activeProfile.parent}}
+ {{#eq activeProfile.inherit 'OVERRIDES'}}
+ <button class="coding-rules-detail-quality-profile-revert button-red">
+ {{t 'coding_rules.revert_to_parent_definition'}}
+ </button>
+ {{/eq}}
+ {{else}}
+ <button class="coding-rules-detail-quality-profile-deactivate button-red">
+ {{t 'coding_rules.deactivate'}}
+ </button>
+ {{/if}}
+ {{else}}
+ <button class="coding-rules-detail-quality-profile-activate">
+ {{t 'coding_rules.activate'}}
+ </button>
+ {{/if}}
+ </div>
+ </td>
+ {{/if}}
+ {{/if}}
+ </tr>
+</table>
_searchParameters: function () {
+ var fields = this.ruleFields.slice(),
+ profile = this.app.state.get('query').qprofile;
+ if (profile != null) {
+ fields.push('actives');
+ }
return {
p: this.app.state.get('page'),
ps: this.pageSize,
facets: this._facetsFromServer().join(),
- f: this.ruleFields.join(),
+ f: fields.join(),
s: 'name',
asc: true
};
model: Rule,
parseRules: function (r) {
- return r.rules;
+ var rules = r.rules;
+ if (r.actives != null) {
+ rules = rules.map(function (rule) {
+ var profiles = r.actives[rule.key];
+ return _.extend(rule, { activeProfiles: profiles });
+ });
+ }
+ return rules;
},
setIndex: function () {
},
serializeData: function () {
+ var activeProfiles = this.model.get('activeProfiles'),
+ activeProfile = _.isArray(activeProfiles) && activeProfiles.length === 1 ? activeProfiles[0] : null,
+ selectedProfile = this.options.app.state.get('query').qprofile;
+ if (selectedProfile != null && activeProfile == null) {
+ activeProfile = selectedProfile;
+ }
return _.extend(WorkspaceListItemView.prototype.serializeData.apply(this, arguments), {
- tags: _.union(this.model.get('sysTags'), this.model.get('tags'))
+ tags: _.union(this.model.get('sysTags'), this.model.get('tags')),
+ canWrite: this.options.app.canWrite,
+ activeProfile: activeProfile
});
}
});
border-top-color: transparent;
}
-.coding-rule-inner {
- .justify;
- margin-bottom: -16px;
+.coding-rule-table {
+ width: 100%;
+
+ td {
+ vertical-align: top;
+ }
+}
+
+.coding-rule-table + .coding-rule-table {
+ margin-top: 5px;
+}
+
+.coding-rule-table-meta-cell {
+ width: 1px;
+ white-space: nowrap;
}
.coding-rule-title {
- display: inline-block;
- vertical-align: baseline;
line-height: @lineHeight;
font-size: @baseFontSize;
}
.coding-rule-meta {
- display: inline-block;
- vertical-align: baseline;
+ padding-left: 30px;
line-height: @lineHeight;
font-size: @smallFontSize;
}
}
+.coding-rule-activation {
+ width: 40px;
+ line-height: @lineHeight;
+}
+
+.coding-rule-activation-actions {
+ padding-left: 20px;
+}
+
.coding-rule-section > div {
max-width: 1020px;
margin: 0 -10px;