OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Change wp attribute fields to grid layout and calculate rows
Inga Mai6288475e9183
diff --git a/frontend/src/app/modules/fields/edit/field/editable-attribute-field.component.ts b/frontend/src/app/modules/fields/edit/field/editable-attribute-field.component.tsindex 949426dc997..9bb90b2c9f6 100644--- a/frontend/src/app/modules/fields/edit/field/editable-attribute-field.component.ts+++ b/frontend/src/app/modules/fields/edit/field/editable-attribute-field.component.ts@@ -118,6 +118,8 @@ export class EditableAttributeFieldComponent extends UntilDestroyedMixin implemethis.resource = resource;this.render();});++ this.calcRows();}// Open the field when its closed and relay drag & drop events to it.@@ -145,6 +147,8 @@ export class EditableAttributeFieldComponent extends UntilDestroyedMixin implemeif (focus) {setTimeout(() => this.$element.find(`.${displayClassName}`).focus(), 20);}++ this.calcRows();}public get isEditable() {@@ -217,4 +221,19 @@ export class EditableAttributeFieldComponent extends UntilDestroyedMixin implemereturn this.schemaCache.of(this.resource) as ISchemaProxy;}}++ /**+ * Calculate the number of rows each edit field should span+ * to create more of a 'masonry' layout look without large gaps+ */+ public calcRows() {+ const rowHeight = 38;+ let elem = jQuery(this.displayContainer.nativeElement);+ let elemHeight = elem.height();++ if (elemHeight !== undefined && elemHeight > rowHeight) {+ let rowspan = Math.ceil(elemHeight / rowHeight);+ elem.closest('.attributes-key-value').css('grid-row', 'span ' + rowspan);+ }+ }}diff --git a/frontend/src/global_styles/content/_attributes_key_value.sass b/frontend/src/global_styles/content/_attributes_key_value.sassindex df5e130473c..53ed64e12c6 100644--- a/frontend/src/global_styles/content/_attributes_key_value.sass+++ b/frontend/src/global_styles/content/_attributes_key_value.sass@@ -49,7 +49,9 @@flex: 1 0 65%max-width: 65%margin-bottom: 0.1875rem+ padding: 0.375rem 0align-self: center+ height: 100%pfont-size: $form-label-fontsizediff --git a/frontend/src/global_styles/openproject/_mixins.sass b/frontend/src/global_styles/openproject/_mixins.sassindex f86a8200324..ac0a4024490 100644--- a/frontend/src/global_styles/openproject/_mixins.sass+++ b/frontend/src/global_styles/openproject/_mixins.sass@@ -133,13 +133,14 @@ $scrollbar-size: 10pxvisibility: hidden@mixin two-column-layout- column-count: 2- column-gap: 3rem+ display: grid+ grid-template-columns: repeat(auto-fill, minmax(45%, 1fr))+ grid-gap: 0 3rem@supports (column-span: all)// Let some elements still span both columns.attributes-key-value.-span-all-columns- column-span: all+ grid-column: -1/1.attributes-key-value--keyflex-basis: calc(22.5% - (4rem / 6)).attributes-key-value--value-container