diff --git a/src/public/app/layouts/desktop_main_window_layout.js b/src/public/app/layouts/desktop_main_window_layout.js index 96b1b72db..125994b8e 100644 --- a/src/public/app/layouts/desktop_main_window_layout.js +++ b/src/public/app/layouts/desktop_main_window_layout.js @@ -136,7 +136,6 @@ export default class DesktopMainWindowLayout { .child(new NoteActionsWidget().hideInZenMode()) ) .child(new TabCachingWidget(() => new AttributeListWidget())) - .child(new TabCachingWidget(() => new PromotedAttributesWidget())) .child(new TabCachingWidget(() => new NoteDetailWidget())) .child(...this.customWidgets.get('center-pane')) ) diff --git a/src/public/app/widgets/attribute_list.js b/src/public/app/widgets/attribute_list.js index 8a09f7ac0..fbdc54f48 100644 --- a/src/public/app/widgets/attribute_list.js +++ b/src/public/app/widgets/attribute_list.js @@ -3,90 +3,102 @@ import AttributeDetailWidget from "./attribute_detail.js"; import attributeRenderer from "../services/attribute_renderer.js"; import AttributeEditorWidget from "./attribute_editor.js"; import options from '../services/options.js'; +import PromotedAttributesWidget from "./promoted_attributes.js"; const TPL = `
- - .inherited-attributes { - color: var(--muted-text-color); - max-height: 200px; - overflow: auto; - padding-bottom: 5px; - padding-left: 7px; - } - - .attribute-list-editor p { - margin: 0 !important; - } - - .attribute-list.error .attribute-list-editor { - border-color: red !important; - } - - .attr-expander { - display: flex; - flex-direction: row; - color: var(--muted-text-color); - font-size: small; - } - - .attribute-list hr { - height: 1px; - border-color: var(--main-border-color); - position: relative; - top: 4px; - margin-top: 5px; - margin-bottom: 0; - } - - .attr-expander-text { - padding-left: 20px; - padding-right: 20px; - white-space: nowrap; - } - - .attr-expander:hover { - cursor: pointer; - } - - .attr-expander:not(.error):hover hr { - border-color: black; - } - - .attr-expander:not(.error):hover .attr-expander-text { - color: black; - } - - -
-
- -
- -
-
- -
-
- -
- -
+

-
+
Promoted attributes

-
-
- +
+ + +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+
`; @@ -94,21 +106,33 @@ export default class AttributeListWidget extends TabAwareWidget { constructor() { super(); + this.promotedAttributesWidget = new PromotedAttributesWidget().setParent(this); this.attributeDetailWidget = new AttributeDetailWidget().setParent(this); this.attributeEditorWidget = new AttributeEditorWidget(this.attributeDetailWidget).setParent(this); - this.child(this.attributeEditorWidget, this.attributeDetailWidget); + this.child(this.promotedAttributesWidget, this.attributeEditorWidget, this.attributeDetailWidget); } doRender() { this.$widget = $(TPL); - this.$attrDisplay = this.$widget.find('.attr-display'); - this.$attrDisplay.toggle(options.is('attributeListExpanded')); + this.$promotedExpander = this.$widget.find('.attr-promoted-expander'); + this.$allAttrWrapper = this.$widget.find('.all-attr-wrapper'); - this.$ownedExpander = this.$widget.find('.attr-owned-expander'); + this.$promotedExpander.on('click', async () => { + if (this.$allAttrWrapper.is(":visible")) { + this.$allAttrWrapper.slideUp(200); + } else { + this.$allAttrWrapper.slideDown(200); + } + }); + + this.$ownedAndInheritedWrapper = this.$widget.find('.owned-and-inherited-wrapper'); + this.$ownedAndInheritedWrapper.toggle(options.is('attributeListExpanded')); + + this.$ownedExpander = this.$widget.find('.attr-owned-and-inherited-expander'); this.$ownedExpander.on('click', async () => { - const collapse = this.$attrDisplay.is(":visible"); + const collapse = this.$ownedAndInheritedWrapper.is(":visible"); await options.save('attributeListExpanded', !collapse); @@ -133,6 +157,7 @@ export default class AttributeListWidget extends TabAwareWidget { this.$inheritedEmptyExpander = this.$widget.find('.attr-inherited-empty-expander'); + this.$widget.find('.promoted-attributes-placeholder').replaceWith(this.promotedAttributesWidget.render()); this.$widget.find('.attr-editor-placeholder').replaceWith(this.attributeEditorWidget.render()); this.$widget.append(this.attributeDetailWidget.render()); } @@ -199,10 +224,9 @@ export default class AttributeListWidget extends TabAwareWidget { */ attributeListCollapsedStateChangedEvent({collapse}) { if (collapse) { - this.$attrDisplay.slideUp(200); - } - else { - this.$attrDisplay.slideDown(200); + this.$ownedAndInheritedWrapper.slideUp(200); + } else { + this.$ownedAndInheritedWrapper.slideDown(200); } } } diff --git a/src/public/app/widgets/promoted_attributes.js b/src/public/app/widgets/promoted_attributes.js index e4e2babca..42c0bb306 100644 --- a/src/public/app/widgets/promoted_attributes.js +++ b/src/public/app/widgets/promoted_attributes.js @@ -5,34 +5,39 @@ import noteAutocompleteService from "../services/note_autocomplete.js"; import TabAwareWidget from "./tab_aware_widget.js"; const TPL = ` -