</td>
{{/if}}
<td class="text-top">{{name}}</td>
- {{#if isDefault}}
- <td class="text-top thin spacer-left">
- <span class="note pull-right">{{t 'default'}}</span>
- </td>
- {{/if}}
+ <td class="text-top thin nowrap spacer-left">
+ {{#if isDefault}}
+ <span class="badge pull-right">{{t 'default'}}</span>
+ {{else}}
+ <span class="note pull-right">{{tp 'quality_profiles.x_projects' projectCountFormatted}}</span>
+ {{/if}}
+ </td>
</tr>
</table>
initProjectsSelect: function () {
var key = this.model.get('key');
- new window.SelectList({
+ this.projectsSelectList = new window.SelectList({
el: this.$('#quality-profile-projects-list'),
width: '100%',
readOnly: !this.options.canWrite,
deselect: t('quality_gates.projects.deselect_hint')
}
});
+ this.listenTo(this.projectsSelectList.collection, 'change:selected', this.onProjectsChange);
},
onProfileClick: function (e) {
this.changeParent();
},
+ onProjectsChange: function () {
+ this.model.collection.updateForLanguage(this.model.get('language'));
+ },
+
changeParent: function () {
new ChangeProfileParentView({
model: this.model
onClick: function (e) {
e.preventDefault();
this.model.trigger('select', this.model);
+ },
+
+ serializeData: function () {
+ return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
+ projectCountFormatted: window.formatMeasure(this.model.get('projectCount'), 'INT')
+ });
}
});
idAttribute: 'key',
defaults: {
- activeRuleCount: 0
+ activeRuleCount: 0,
+ projectCount: 0
},
fetch: function () {
parse: function (r) {
return r.profiles;
+ },
+
+ updateForLanguage: function (language) {
+ this.fetch({
+ data: {
+ language: language
+ },
+ merge: true,
+ reset: false,
+ remove: false
+ });
}
});
test.assertSelectorContains('.js-list-language', 'PHP');
test.assertSelectorContains('.js-list-language', 'Python');
- test.assertElementCount('.js-list .note', 4);
+ test.assertElementCount('.js-list .badge', 4);
})
.then(function () {
})
.then(function () {
- test.assertDoesntExist('.js-list .list-group-item[data-key="php-psr-2-46772"] .note');
- test.assertExists('.js-list .list-group-item[data-key="php-sonar-way-10778"] .note');
+ test.assertDoesntExist('.js-list .list-group-item[data-key="php-psr-2-46772"] .badge');
+ test.assertExists('.js-list .list-group-item[data-key="php-sonar-way-10778"] .badge');
casper.click('.js-list .list-group-item[data-key="php-psr-2-46772"]');
casper.waitForSelector('#quality-profile-set-as-default');
})
lib.mockRequestFromFile('/api/qualityprofiles/search', 'search-another-default.json');
casper.click('#quality-profile-set-as-default');
- casper.waitWhileSelector('.js-list .list-group-item[data-key="php-sonar-way-10778"] .note');
+ casper.waitWhileSelector('.js-list .list-group-item[data-key="php-sonar-way-10778"] .badge');
})
.then(function () {
test.assertDoesntExist('#quality-profile-set-as-default');
- test.assertExists('.js-list .list-group-item[data-key="php-psr-2-46772"] .note');
+ test.assertExists('.js-list .list-group-item[data-key="php-psr-2-46772"] .badge');
})
.then(function () {
quality_profiles.change_parent=Change Parent
quality_profiles.all_profiles=All Profiles
quality_profiles.x_profiles={0} Profiles
+quality_profiles.x_projects={0} projects