Skip to content

Commit

Permalink
Hide caption variants select if only one item
Browse files Browse the repository at this point in the history
Also hide separator if last child of configuration editor tab.
  • Loading branch information
tf committed Nov 29, 2024
1 parent 22bedc4 commit c45ae07
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 c45ae07

Please sign in to comment.