Skip to content

Commit c45ae07

Browse files
committed
Hide caption variants select if only one item
Also hide separator if last child of configuration editor tab.
1 parent 22bedc4 commit c45ae07

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

app/assets/stylesheets/pageflow/ui/forms.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ textarea.short {
121121
.separator {
122122
border-top: solid 1px var(--ui-on-surface-color-lightest);
123123
margin: space(4) 0;
124+
125+
&:last-child {
126+
display: none;
127+
}
124128
}
125129
}
126130

entry_types/scrolled/package/src/editor/views/configurationEditors/groups/CommonContentElementAttributes.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,21 @@ ConfigurationEditorTabView.groups.define(
125125
name: 'figureCaption'
126126
});
127127

128-
this.input('captionVariant', SelectInputView, {
129-
attributeTranslationKeyPrefixes: [
130-
'pageflow_scrolled.editor.common_content_element_attributes'
131-
],
132-
includeBlank: true,
133-
blankTranslationKey: 'pageflow_scrolled.editor.' +
134-
'common_content_element_attributes.' +
135-
'captionVariant.blank',
136-
values: variants,
137-
texts,
138-
disabledBindingModel: this.model.parent.transientState,
139-
disabledBinding: 'hasCaption',
140-
disabled: hasCaption => disableWhenNoCaption && !hasCaption
141-
});
128+
if (variants.length) {
129+
this.input('captionVariant', SelectInputView, {
130+
attributeTranslationKeyPrefixes: [
131+
'pageflow_scrolled.editor.common_content_element_attributes'
132+
],
133+
includeBlank: true,
134+
blankTranslationKey: 'pageflow_scrolled.editor.' +
135+
'common_content_element_attributes.' +
136+
'captionVariant.blank',
137+
values: variants,
138+
texts,
139+
disabledBindingModel: this.model.parent.transientState,
140+
disabledBinding: 'hasCaption',
141+
disabled: hasCaption => disableWhenNoCaption && !hasCaption
142+
});
143+
}
142144
}
143145
);

0 commit comments

Comments
 (0)