0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00

fixed formatting

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-02-15 13:39:37 +05:30
Ursprung 4ca82b9f4d
Commit b74526ae4f

Datei anzeigen

@ -4,7 +4,7 @@ import { cloneJSON } from "discourse-common/lib/object";
import Category from "discourse/models/category"; import Category from "discourse/models/category";
export default Component.extend({ export default Component.extend({
classNames: ['realtime-validations'], classNames: ["realtime-validations"],
init() { init() {
this._super(...arguments); this._super(...arguments);
@ -16,22 +16,28 @@ export default Component.extend({
validations[validation] = {}; validations[validation] = {};
}); });
this.set('field.validations', EmberObject.create(validations)); this.set("field.validations", EmberObject.create(validations));
} }
const validationBuffer = cloneJSON(this.get('field.validations')); const validationBuffer = cloneJSON(this.get("field.validations"));
let bufferCategories; let bufferCategories;
if( validationBuffer.similar_topics && (bufferCategories = validationBuffer.similar_topics.categories)) { if (
validationBuffer.similar_topics &&
(bufferCategories = validationBuffer.similar_topics.categories)
) {
const categories = Category.findByIds(bufferCategories); const categories = Category.findByIds(bufferCategories);
validationBuffer.similar_topics.categories = categories; validationBuffer.similar_topics.categories = categories;
} }
this.set('validationBuffer', validationBuffer); this.set("validationBuffer", validationBuffer);
}, },
actions: { actions: {
updateValidationCategories(name, validation, categories) { updateValidationCategories(name, validation, categories) {
this.set(`validationBuffer.${name}.categories`, categories); this.set(`validationBuffer.${name}.categories`, categories);
this.set(`field.validations.${name}.categories`, categories.map(category => category.id)); this.set(
} `field.validations.${name}.categories`,
} categories.map((category) => category.id)
);
},
},
}); });