mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: combo-box should observe on nameProperty
This commit is contained in:
parent
1e2e450772
commit
969fb2cd4c
@ -14,8 +14,12 @@ export default Ember.Component.extend({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
realNameProperty: function() {
|
||||||
|
return this.get('nameProperty') || 'name';
|
||||||
|
}.property('nameProperty'),
|
||||||
|
|
||||||
render(buffer) {
|
render(buffer) {
|
||||||
const nameProperty = this.get('nameProperty') || 'name',
|
const nameProperty = this.get('realNameProperty'),
|
||||||
none = this.get('none');
|
none = this.get('none');
|
||||||
|
|
||||||
// Add none option if required
|
// Add none option if required
|
||||||
@ -64,6 +68,10 @@ export default Ember.Component.extend({
|
|||||||
o.selected = !!$(o).attr('selected');
|
o.selected = !!$(o).attr('selected');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Workaround for contentChanged not being able to observe based on
|
||||||
|
// a passed-in attribute name
|
||||||
|
this.addObserver('content.@each.' + this.get('realNameProperty'), this.rerender);
|
||||||
|
|
||||||
$elem.select2({formatResult: this.comboTemplate, minimumResultsForSearch: 5, width: 'resolve'});
|
$elem.select2({formatResult: this.comboTemplate, minimumResultsForSearch: 5, width: 'resolve'});
|
||||||
|
|
||||||
const castInteger = this.get('castInteger');
|
const castInteger = this.get('castInteger');
|
||||||
|
Loading…
Reference in New Issue
Block a user