Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 17:30:29 +01:00
fixed similar topics validator formatting
Dieser Commit ist enthalten in:
Ursprung
70cc20a919
Commit
afbc4e1f57
1 geänderte Dateien mit 44 neuen und 44 gelöschten Zeilen
|
@ -2,16 +2,15 @@ import WizardFieldValidator from "../../wizard/components/validator";
|
|||
import { deepMerge } from "discourse-common/lib/object";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { cancel, later } from "@ember/runloop";
|
||||
import { A } from '@ember/array';
|
||||
import { A } from "@ember/array";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
export default WizardFieldValidator.extend({
|
||||
similarTopics: [],
|
||||
|
||||
validate() {
|
||||
},
|
||||
validate() {},
|
||||
@observes("field.value")
|
||||
customValidate(){
|
||||
customValidate() {
|
||||
const lastKeyUp = new Date();
|
||||
this._lastKeyUp = lastKeyUp;
|
||||
|
||||
|
@ -27,27 +26,28 @@ export default WizardFieldValidator.extend({
|
|||
}, 1000);
|
||||
},
|
||||
|
||||
updateSimilarTopics(){
|
||||
updateSimilarTopics() {
|
||||
this.backendValidate({
|
||||
title: this.get("field.value"),
|
||||
categories: this.get('validation.categories'),
|
||||
date_after: this.get('validation.date_after')
|
||||
categories: this.get("validation.categories"),
|
||||
date_after: this.get("validation.date_after"),
|
||||
}).then((result) => {
|
||||
const similarTopics = A(deepMerge(result['topics'], result['similar_topics']));
|
||||
similarTopics.forEach(function(topic, index) {
|
||||
const similarTopics = A(
|
||||
deepMerge(result["topics"], result["similar_topics"])
|
||||
);
|
||||
similarTopics.forEach(function (topic, index) {
|
||||
similarTopics[index] = EmberObject.create(topic);
|
||||
});
|
||||
|
||||
this.set('similarTopics', similarTopics);
|
||||
this.set("similarTopics", similarTopics);
|
||||
});
|
||||
},
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
},
|
||||
actions: {
|
||||
closeMessage(){
|
||||
this.set('showMessage', false);
|
||||
}
|
||||
}
|
||||
closeMessage() {
|
||||
this.set("showMessage", false);
|
||||
},
|
||||
},
|
||||
});
|
Laden …
In neuem Issue referenzieren