Refined visibility dropdown in post settings

This commit is contained in:
Peter Zimon 2021-07-06 14:51:36 +02:00
parent 830d24cb20
commit 7778d3c470
2 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@
</GhFormGroup> </GhFormGroup>
{{#if (eq this.post.visibility "filter")}} {{#if (eq this.post.visibility "filter")}}
<GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibilityFilter"> <GhFormGroup @errors={{this.post.errors}} @hasValidated={{this.post.hasValidated}} @property="visibilityFilter" @class="nt3">
<GhMembersSegmentSelect <GhMembersSegmentSelect
@hideLabels={{true}} @hideLabels={{true}}
@segment={{this.post.visibilitySegment}} @segment={{this.post.visibilitySegment}}

View File

@ -69,14 +69,14 @@ export default BaseValidator.create({
visibility(model) { visibility(model) {
if (isBlank(model.visibility) && !model.isNew) { if (isBlank(model.visibility) && !model.isNew) {
model.errors.add('visibility', 'Please select a product'); model.errors.add('visibility', 'Please select at least one product');
this.invalidate(); this.invalidate();
} }
}, },
visibilityFilter(model) { visibilityFilter(model) {
if (isBlank(model.visibilityFilter) && !isBlank(model.visibility) && model.visibility === 'filter' && !model.isNew) { if (isBlank(model.visibilityFilter) && !isBlank(model.visibility) && model.visibility === 'filter' && !model.isNew) {
model.errors.add('visibilityFilter', 'Please select a product'); model.errors.add('visibilityFilter', 'Please select at least one product');
this.invalidate(); this.invalidate();
} }
}, },