0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/assets/javascripts/wizard/components/wizard-field-category.js.es6

14 Zeilen
472 B
Text

2019-07-26 10:59:41 +02:00
import { observes } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
@observes('categories')
setValue() {
const categories = this.get('categories');
if (categories.length) {
const limit = this.get('field.limit');
const property = this.get('field.property') || 'id';
let value = limit === 1 ? categories[0][property] : categories.map(c => c[property]);
this.set('field.value', value);
}
2019-07-26 10:59:41 +02:00
}
});