0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
Dieser Commit ist enthalten in:
Faizaan Gagan 2021-03-25 11:30:57 +05:30
Ursprung c62f1ac96f
Commit ee613d74c8

Datei anzeigen

@ -4,7 +4,7 @@ import { observes } from "discourse-common/utils/decorators";
import { cancel, later } from "@ember/runloop"; import { cancel, later } from "@ember/runloop";
import { A } from "@ember/array"; import { A } from "@ember/array";
import EmberObject, { computed } from "@ember/object"; import EmberObject, { computed } from "@ember/object";
import { notEmpty, and, equal, empty, alias } from "@ember/object/computed"; import { notEmpty, and, equal, empty } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { categoryBadgeHTML } from "discourse/helpers/category-link"; import { categoryBadgeHTML } from "discourse/helpers/category-link";
import { dasherize } from "@ember/string"; import { dasherize } from "@ember/string";
@ -12,8 +12,7 @@ import { dasherize } from "@ember/string";
export default WizardFieldValidator.extend({ export default WizardFieldValidator.extend({
classNames: ['similar-topics-validator'], classNames: ['similar-topics-validator'],
similarTopics: null, similarTopics: null,
input: alias('field.value'), hasInput: notEmpty('field.value'),
hasInput: notEmpty('input'),
hasSimilarTopics: notEmpty('similarTopics'), hasSimilarTopics: notEmpty('similarTopics'),
hasNotSearched: equal('similarTopics', null), hasNotSearched: equal('similarTopics', null),
noSimilarTopics: computed('similarTopics', function() { noSimilarTopics: computed('similarTopics', function() {
@ -22,8 +21,8 @@ export default WizardFieldValidator.extend({
showDefault: computed('hasNotSearched', 'hasInput', 'typing', function() { showDefault: computed('hasNotSearched', 'hasInput', 'typing', function() {
return this.hasInput && (this.hasNotSearched || this.typing); return this.hasInput && (this.hasNotSearched || this.typing);
}), }),
insufficientCharacters: computed('typing', 'input', function() { insufficientCharacters: computed('typing', 'field.value', function() {
return this.hasInput && this.input.length < 5 && !this.typing; return this.hasInput && this.field.value.length < 5 && !this.typing;
}), }),
showSimilarTopics: computed('typing', 'hasSimilarTopics', function() { showSimilarTopics: computed('typing', 'hasSimilarTopics', function() {
return this.hasSimilarTopics && !this.typing; return this.hasSimilarTopics && !this.typing;