From a1c8b53e6479504154d5fbfbb6bdf28ed81a5630 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 26 Jul 2019 18:59:41 +1000 Subject: [PATCH] Only save category ids --- .../wizard/components/wizard-field-category.js.es6 | 9 +++++++++ .../templates/components/wizard-field-category.hbs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 assets/javascripts/wizard/components/wizard-field-category.js.es6 diff --git a/assets/javascripts/wizard/components/wizard-field-category.js.es6 b/assets/javascripts/wizard/components/wizard-field-category.js.es6 new file mode 100644 index 00000000..83a50e58 --- /dev/null +++ b/assets/javascripts/wizard/components/wizard-field-category.js.es6 @@ -0,0 +1,9 @@ +import { observes } from 'ember-addons/ember-computed-decorators'; + +export default Ember.Component.extend({ + @observes('categories') + setValue() { + const categories = this.get('categories'); + this.set('field.value', categories.map(c => c.id)); + } +}); \ No newline at end of file diff --git a/assets/javascripts/wizard/templates/components/wizard-field-category.hbs b/assets/javascripts/wizard/templates/components/wizard-field-category.hbs index e9b0c41f..abf301df 100644 --- a/assets/javascripts/wizard/templates/components/wizard-field-category.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-field-category.hbs @@ -1,2 +1,2 @@ -{{category-selector categories=field.value maximum=field.limit}} +{{category-selector categories=categories maximum=field.limit}}