0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-custom-input-chooser.js.es6
2020-03-22 04:30:11 +11:00

46 Zeilen
Kein EOL
1,2 KiB
JavaScript

import { alias, equal } from "@ember/object/computed";
import { computed } from "@ember/object";
import {
default as discourseComputed,
observes
} from "discourse-common/utils/decorators";
export default Ember.Component.extend({
@observes('activeType')
clearValue() {
this.set('value', null);
},
@discourseComputed('customPlaceholder')
textPlaceholder(customPlaceholder) {
return customPlaceholder || 'admin.wizard.text';
},
@discourseComputed('activeType', 'userEnabled')
showUser(activeType, userEnabled) {
return activeType === 'user' && userEnabled;
},
@discourseComputed('activeType', 'wizardEnabled')
showWizard(activeType, wizardEnabled) {
return activeType === 'wizard' && wizardEnabled;
},
showText: equal('activeType', 'text'),
@discourseComputed('options.allowWizardField', 'inputType')
wizardEnabled(allowWizardField, inputType) {
return allowWizardField === true || allowWizardField === inputType;
},
@discourseComputed('options.allowUserField', 'inputType')
userEnabled(allowUserField, inputType) {
return allowUserField === true || allowUserField === inputType;
},
actions: {
toggleType(type) {
this.set('activeType', type);
}
}
})