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
fix: make all attribute groups except for wps single column (#13338)
Yuleb832fb80bbf5
diff --git a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sassindex 17fd975cea8..6be5d8599dd 100644--- a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass+++ b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass@@ -1,8 +1,69 @@@import "src/assets/sass/helpers"+// The attribute groups for work packages are a bit different thant on other pages:+//+// In summary, we get the following:+//+// Parent < 800px: 1 Column view where only the long text fields have labels on top+// Parent > 800px: 2 Column view where all fields have left-right labels, and long text fields span both columns+//+// More specifically:+//+// Requirements for the attribute sections in the WP view+// * Number of columns: min 1, max 2.+// * Min-width: 400px, max-width: not wider than the parent.+// * When two-columns are shown, each column has 50% width of the parent.+// * We cannot use breakpoints, since the width of the parent can be changed+// dynamically by sliding the sidemenu or split view.+// * Some attributes span 2 columns, like long text fields.+// * Labels should be left-right, except for long text fields when the layout+// is in single-column mode.+// * Labels should be a fixed 140px wide, all having the same width.wp-attribute-group+ display: flex+ flex-direction: row+ flex-wrap: wrap++ // We want a margin between items, but not between items and the parent box.+ //+ // We don't know if any one item is on the right,+ // the left, or spanning both columns. The easy way to get a gutter is to give+ // *all* elements margins on both sides, and then negating this margin on the parent.+ // This also explains all of the + and - xrem calc() values below.+ margin: 0 -1 * $spot-spacing-1_5+ width: calc(100% + #{$spot-spacing-3})+&--attribute+ flex-basis: 400px+ flex-grow: 1+ flex-shrink: 1+ min-width: calc(50% - 3rem)+ max-width: calc(100% - 3rem)+ margin: 0 1.5rem+&_span-allflex-basis: calc(100% - #{$spot-spacing-3})flex-shrink: 0flex-wrap: wrap++ &-key+ flex-basis: 140px++ @media screen and (min-width: $breakpoint-md)+ // The reason we add this is because the base `attributes-key-value--key` class will override this at this+ // breakpoint, since it will always stay single column. However, for work package attributes we go double column+ // and thus want the labels to stay smaller+ flex-basis: 140px++ &-value-container+ flex-basis: 260px++ &_span-all &-value-container+ flex-shrink: 0+ // This is a magic number that was obtained by trial and error+ // The goal is to have span-all containers move to label-on-top+ // right as the layout goes from 2-column to 1-column.+ // There problably is some calculation by which you can derive this,+ // but I'm currently too lazy to figure it out+ flex-basis: 708px+ max-width: 100%diff --git a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.htmlindex 946b529d7cd..22dbea0e0d5 100644--- a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html+++ b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.template.html@@ -5,7 +5,7 @@><ng-template [ngIf]="!shouldHideField(descriptor)"><div- class="attributes-key-value--key"+ class="wp-attribute-group--attribute-key attributes-key-value--key"*ngIf="!descriptor.multiple && descriptor.field"><wp-replacement-label [fieldName]="descriptor.name">@@ -19,7 +19,7 @@</div><div*ngIf="!descriptor.multiple && descriptor.field"- class="attributes-key-value--value-container"+ class="wp-attribute-group--attribute-value-container attributes-key-value--value-container"><op-editable-attribute-field[ngClass]="{'wp-edit-formattable-field': descriptor.field!.isFormattable }"diff --git a/frontend/src/global_styles/content/_attributes_group.sass b/frontend/src/global_styles/content/_attributes_group.sassindex 325b5f7dc22..c984957424d 100644--- a/frontend/src/global_styles/content/_attributes_group.sass+++ b/frontend/src/global_styles/content/_attributes_group.sass@@ -80,13 +80,4 @@.attributes-group--attributesdisplay: flex- flex-direction: row- flex-wrap: wrap-- // We want a margin between items, but don't know if any one item is on the right,- // the left, or spanning both columns. The easy way to get a gutter is to give- // *all* elements margins on both sides, and then negating this margin on the parent.- // This also explains all of the + and - xrem calc() values below.- margin: 0 -1 * $spot-spacing-1_5- width: calc(100% + #{$spot-spacing-3})-+ flex-direction: columndiff --git a/frontend/src/global_styles/content/_attributes_key_value.sass b/frontend/src/global_styles/content/_attributes_key_value.sassindex a414435c420..510e1acbb02 100644--- a/frontend/src/global_styles/content/_attributes_key_value.sass+++ b/frontend/src/global_styles/content/_attributes_key_value.sass@@ -31,14 +31,7 @@// flex-wrap: wrapfont-size: 0.875remmargin-bottom: 0.1875rem- flex-basis: 400px- flex-grow: 1- flex-shrink: 1- min-width: calc(50% - 3rem)- max-width: calc(100% - 3rem)- margin: 0 1.5remline-height: 1.5em- gap: 10px&--key@extend .form--label@@ -50,6 +43,12 @@overflow-wrap: break-wordhyphens: auto+ @media screen and (min-width: $breakpoint-md)+ flex-basis: 200px++ @media screen and (min-width: $breakpoint-lg)+ flex-basis: 240px+> wp-replacement-labelpadding-right: $spot-spacing-0_5flex: 1 1 auto@@ -79,16 +78,6 @@@include grid-visible-overflowword-wrap: anywhere- @at-root &.wp-attribute-group--attribute_span-all &--value-container- flex-shrink: 0- // This is a magic number that was obtained by trial and error- // The goal is to have span-all containers move to label-on-top- // right as the layout goes from 2-column to 1-column.- // There problably is some calculation by which you can derive this,- // but I'm currently too lazy to figure it out- flex-basis: 708px- max-width: 100%-// Alternative implementation to the one above.// It's main advantage is that it can act on the whole of the key/value-pairs.// It can e.g. determine the width of the widest label and by that align all key value pairs equally.