Skip to content

Commit

Permalink
Merge pull request #2181 from tf/hide-empty-caption-variants
Browse files Browse the repository at this point in the history
Hide caption variants select if only one item
  • Loading branch information
tf authored Nov 29, 2024
2 parents 2936e8c + 66c22cc commit 59534cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/pageflow/ui/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ textarea.short {
.separator {
border-top: solid 1px var(--ui-on-surface-color-lightest);
margin: space(4) 0;

&:last-child {
display: none;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,21 @@ ConfigurationEditorTabView.groups.define(
name: 'figureCaption'
});

this.input('captionVariant', SelectInputView, {
attributeTranslationKeyPrefixes: [
'pageflow_scrolled.editor.common_content_element_attributes'
],
includeBlank: true,
blankTranslationKey: 'pageflow_scrolled.editor.' +
'common_content_element_attributes.' +
'captionVariant.blank',
values: variants,
texts,
disabledBindingModel: this.model.parent.transientState,
disabledBinding: 'hasCaption',
disabled: hasCaption => disableWhenNoCaption && !hasCaption
});
if (variants.length) {
this.input('captionVariant', SelectInputView, {
attributeTranslationKeyPrefixes: [
'pageflow_scrolled.editor.common_content_element_attributes'
],
includeBlank: true,
blankTranslationKey: 'pageflow_scrolled.editor.' +
'common_content_element_attributes.' +
'captionVariant.blank',
values: variants,
texts,
disabledBindingModel: this.model.parent.transientState,
disabledBinding: 'hasCaption',
disabled: hasCaption => disableWhenNoCaption && !hasCaption
});
}
}
);

0 comments on commit 59534cf

Please sign in to comment.