Skip to content

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

limit max width of the role group keys in the members widget

ulfertsa1d5c84ba927
diff --git a/app/assets/stylesheets/content/_attributes_key_value.sass b/app/assets/stylesheets/content/_attributes_key_value.sass
index 006538cc610..a5359ead18a 100644
--- a/app/assets/stylesheets/content/_attributes_key_value.sass
+++ b/app/assets/stylesheets/content/_attributes_key_value.sass
@@ -31,49 +31,63 @@
flex-wrap: wrap
font-size: 0.875rem
- .attributes-key-value--key
- @extend .form--label
- display: flex
- flex: 1 0 35%
- max-width: 35%
- margin-bottom: 0.1875rem
- padding: 0.375rem 0
- font-weight: bold
- // Ensure that the text is shortened while the help icon will be displayed
- > wp-replacement-label
- @include text-shortener
- flex: 0 1 auto
+.attributes-key-value--key
+ @extend .form--label
+ display: flex
+ flex: 1 0 35%
+ max-width: 35%
+ margin-bottom: 0.1875rem
+ padding: 0.375rem 0
+ font-weight: bold
+ // Ensure that the text is shortened while the help icon will be displayed
+ > wp-replacement-label
+ @include text-shortener
+ flex: 0 1 auto
+
+.attributes-key-value--value-container
+ display: flex
+ flex: 1 0 65%
+ max-width: 65%
+ margin-bottom: 0.1875rem
+ align-self: center
+
+ p
+ font-size: $form-label-fontsize
+ word-wrap: break-word
+
+ &.not-editable
+ padding: 6px
+
+.attributes-key-value--value-separator
+ margin: 0px 4px
- &.-minimal
- @include text-shortener
- flex: 0 1 auto
+ &:after
+ display: inline
+ content: '-'
- .attributes-key-value--value-container
- display: flex
- flex: 1 0 65%
- max-width: 65%
- margin-bottom: 0.1875rem
- align-self: center
+.attributes-key-value--value
+ @include grid-visible-overflow
- p
- font-size: $form-label-fontsize
- word-wrap: break-word
+// 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.
- &.not-editable
- padding: 6px
+.attributes-map
+ display: grid
+ grid-template-columns: 1fr 4fr
+ grid-auto-rows: auto
+ grid-gap: 1rem
- &.-minimal
- wp-edit-field
- flex-basis: 90px
- .wp-inline-edit--field
- width: 90px
+ &.-minimal-keys
+ grid-template-columns: max-content 4fr
- .attributes-key-value--value-separator
- margin: 0px 4px
+.attributes-map--key
+ @include text-shortener
+ font-weight: bold
- &:after
- display: inline
- content: '-'
+ .attributes-map.-minimal-keys &
+ max-width: 200px
- .attributes-key-value--value
- @include grid-visible-overflow
+.attributes-map--value
+ // empty for now but it makes sense to also have it present in the style declaration IMO
+ zoom: 1
diff --git a/frontend/src/app/modules/grids/widgets/members/members.component.html b/frontend/src/app/modules/grids/widgets/members/members.component.html
index 409b01d9a13..a5ef1a8865c 100644
--- a/frontend/src/app/modules/grids/widgets/members/members.component.html
+++ b/frontend/src/app/modules/grids/widgets/members/members.component.html
@@ -12,30 +12,31 @@
<no-results *ngIf="noMembers"
[title]="text.noResults">
</no-results>
- <div class="attributes-key-value" *ngFor="let usersByRole of usersByRole">
- <div class="attributes-key-value--key -minimal">
- {{usersByRole.role.name}}:
- </div>
- <div class="attributes-key-value--value-container">
- <div class="attributes-key-value--value">
- <span *ngFor="let principal of usersByRole.users; let last = last">
+ <div class="attributes-map -minimal-keys">
+ <ng-container *ngFor="let usersByRole of usersByRole">
+ <div class="attributes-map--key">
+ {{usersByRole.role.name}}
+ </div>
+
+ <div class="attributes-map--value">
+ <span *ngFor="let principal of usersByRole.users; let last = last">
- <ng-container *ngIf="isGroup(principal)">
- {{userName(principal)}}
- </ng-container>
- <ng-container *ngIf="!isGroup(principal)">
- <user-avatar [user]="principal"
- data-class-list="avatar avatar-mini -spaced">
- </user-avatar>
- <a [href]="userPath(principal)"
- [textContent]="userName(principal)">
- </a>
- </ng-container>
+ <ng-container *ngIf="isGroup(principal)">
+ {{userName(principal)}}
+ </ng-container>
+ <ng-container *ngIf="!isGroup(principal)">
+ <user-avatar [user]="principal"
+ data-class-list="avatar avatar-mini -spaced">
+ </user-avatar>
+ <a [href]="userPath(principal)"
+ [textContent]="userName(principal)">
+ </a>
+ </ng-container>
- <ng-container *ngIf="!last">, </ng-container>
- </span>
+ <ng-container *ngIf="!last">, </ng-container>
+ </span>
</div>
- </div>
+ </ng-container>
</div>
<div *ngIf="moreMembers"
class="members-widget--notification">
diff --git a/frontend/src/app/modules/grids/widgets/members/members.component.sass b/frontend/src/app/modules/grids/widgets/members/members.component.sass
index 6871e829761..192dbf47bed 100644
--- a/frontend/src/app/modules/grids/widgets/members/members.component.sass
+++ b/frontend/src/app/modules/grids/widgets/members/members.component.sass
@@ -8,11 +8,6 @@
.button
margin-bottom: 0
-.attributes-key-value--value
- line-height: 1.5rem
-
-.attributes-key-value--key
- padding-right: 5px
-
-.attributes-key-value
+.attributes-map
padding-bottom: 0.875rem
+ line-height: 1.5rem