Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
fixed formatting
Dieser Commit ist enthalten in:
Ursprung
4ca82b9f4d
Commit
b74526ae4f
1 geänderte Dateien mit 32 neuen und 26 gelöschten Zeilen
|
@ -4,34 +4,40 @@ 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(){
|
|
||||||
this._super(...arguments);
|
|
||||||
if (!this.validations) return;
|
|
||||||
|
|
||||||
if (!this.field.validations) {
|
init() {
|
||||||
const validations = {};
|
this._super(...arguments);
|
||||||
this.validations.forEach((validation) => {
|
if (!this.validations) return;
|
||||||
validations[validation] = {};
|
|
||||||
});
|
|
||||||
|
|
||||||
this.set('field.validations', EmberObject.create(validations));
|
if (!this.field.validations) {
|
||||||
}
|
const validations = {};
|
||||||
|
this.validations.forEach((validation) => {
|
||||||
|
validations[validation] = {};
|
||||||
|
});
|
||||||
|
|
||||||
const validationBuffer = cloneJSON(this.get('field.validations'));
|
this.set("field.validations", EmberObject.create(validations));
|
||||||
let bufferCategories;
|
|
||||||
if( validationBuffer.similar_topics && (bufferCategories = validationBuffer.similar_topics.categories)) {
|
|
||||||
const categories = Category.findByIds(bufferCategories);
|
|
||||||
validationBuffer.similar_topics.categories = categories;
|
|
||||||
}
|
|
||||||
this.set('validationBuffer', validationBuffer);
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
updateValidationCategories(name, validation, categories) {
|
|
||||||
this.set(`validationBuffer.${name}.categories`, categories);
|
|
||||||
this.set(`field.validations.${name}.categories`, categories.map(category => category.id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const validationBuffer = cloneJSON(this.get("field.validations"));
|
||||||
|
let bufferCategories;
|
||||||
|
if (
|
||||||
|
validationBuffer.similar_topics &&
|
||||||
|
(bufferCategories = validationBuffer.similar_topics.categories)
|
||||||
|
) {
|
||||||
|
const categories = Category.findByIds(bufferCategories);
|
||||||
|
validationBuffer.similar_topics.categories = categories;
|
||||||
|
}
|
||||||
|
this.set("validationBuffer", validationBuffer);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
updateValidationCategories(name, validation, categories) {
|
||||||
|
this.set(`validationBuffer.${name}.categories`, categories);
|
||||||
|
this.set(
|
||||||
|
`field.validations.${name}.categories`,
|
||||||
|
categories.map((category) => category.id)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
Laden …
In neuem Issue referenzieren