Don't recalculate trustLevels combobox

This commit is contained in:
Robin Ward 2013-07-12 16:24:15 -04:00
parent 62d161fd70
commit 0c7ead339b
3 changed files with 7 additions and 7 deletions

View File

@ -67,10 +67,8 @@ Discourse.AdminUser = Discourse.User.extend({
},
trustLevels: function() {
return Discourse.Site.instance().get('trustLevels').map(function (tl) {
return {id: tl.get('id'), name: tl.get('detailedName') };
});
}.property('trust_level'),
return Discourse.Site.instance().get('trustLevels');
}.property(),
dirty: Discourse.computed.propertyNotEqual('originalTrustLevel', 'trustLevel.id'),

View File

@ -165,7 +165,7 @@
<div class='display-row'>
<div class='field'>{{i18n trust_level}}</div>
<div class="value">
{{combobox content=trustLevels value=trust_level }}
{{combobox content=trustLevels value=trust_level nameProperty="detailedName"}}
</div>
<div class="controls">
{{#if dirty}}

View File

@ -13,6 +13,8 @@ Discourse.ComboboxView = Discourse.View.extend({
render: function(buffer) {
var nameProperty = this.get('nameProperty') || 'name';
// Add none option if required
if (this.get('none')) {
buffer.push('<option value="">' + (I18n.t(this.get('none'))) + "</option>");
@ -33,10 +35,10 @@ Discourse.ComboboxView = Discourse.View.extend({
var data = "";
if (comboboxView.dataAttributes) {
comboboxView.dataAttributes.forEach(function(a) {
data += "data-" + a + "=\"" + (o.get(a)) + "\" ";
data += "data-" + a + "=\"" + o.get(a) + "\" ";
});
}
buffer.push("<option " + selectedText + " value=\"" + val + "\" " + data + ">" + o.name + "</option>");
buffer.push("<option " + selectedText + " value=\"" + val + "\" " + data + ">" + Em.get(o, nameProperty) + "</option>");
});
}
},