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

Feature/37870 make in app notification center responsive to mobile sizes (#9413)

Wieland Lindenthal553cf861d148
diff --git a/frontend/src/app/core/datetime/timezone.service.ts b/frontend/src/app/core/datetime/timezone.service.ts
index c452bfb6cf9..d211df8494b 100644
--- a/frontend/src/app/core/datetime/timezone.service.ts
+++ b/frontend/src/app/core/datetime/timezone.service.ts
@@ -136,7 +136,7 @@ export class TimezoneService {
return `${c[0]} ${c[1]}`;
}
- public formattedRelativeDateTime(datetimeString:string) {
+ public formattedRelativeDateTime(datetimeString:string):string {
const d = this.parseDatetime(datetimeString);
return d.fromNow();
}
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
index 071f6f4f7ac..b6bf34bbcf5 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html
@@ -9,59 +9,59 @@
class="op-ian-item--row"
(click)="toggleDetails()"
>
- <div class="op-ian-item--message">
- <a
- *ngIf="project"
- class="op-ian-item--project"
- [href]="project.showUrl"
- [textContent]="project.title"
- (click)="projectClicked($event)"
- target="_blank"
- ></a>
- <ng-container *ngIf="workPackage$ && (workPackage$ | async) as workPackage; else workPackageLoading">
+ <a
+ *ngIf="project"
+ class="op-ian-item--project"
+ [href]="project.showUrl"
+ [textContent]="project.title"
+ (click)="projectClicked($event)"
+ target="_blank"
+ ></a>
+ <ng-container *ngIf="workPackage$ && (workPackage$ | async) as workPackage; else workPackageLoading">
+ <span
+ class="op-ian-item--title"
+ ngPreserveWhitespaces
+ >
+ <span [ngClass]="'__hl_inline_type_' + workPackage.type.id" [textContent]="workPackage.type.name">
+ </span>
+ <a
+ [attr.title]="workPackage.subject"
+ uiSref="work-packages.show"
+ [uiParams]="{workPackageId: workPackage.id}"
+ [textContent]="'#' + workPackage.id"
+ (click)="resourceLinkClicked.emit(workPackage)"
+ >
+ </a>
<span
- class="op-ian-item--title"
- ngPreserveWhitespaces
+ [textContent]="workPackage.subject"
+ class="op-ian-item--work-package-subject"
+ [class.-read]="notification.readIAN"
>
- <span [ngClass]="'__hl_inline_type_' + workPackage.type.id" [textContent]="workPackage.type.name">
- </span>
- <a
- [attr.title]="workPackage.subject"
- uiSref="work-packages.show"
- [uiParams]="{workPackageId: workPackage.id}"
- [textContent]="'#' + workPackage.id"
- (click)="resourceLinkClicked.emit(workPackage)"
- >
- </a>
- <span
- [textContent]="workPackage.subject"
- class="op-ian-item--work-package-subject"
- [class.-read]="notification.readIAN"
- >
- </span>
</span>
- </ng-container>
- <ng-template #workPackageLoading>
- <span
- class="op-ian-item--title"
- [textContent]="text.loading"
- ></span>
- </ng-template>
- <ng-container *ngIf="!workPackage$">
- <span
- class="op-ian-item--title"
- [textContent]="notification.subject"
- ></span>
- </ng-container>
- </div>
+ </span>
+ </ng-container>
+ <ng-template #workPackageLoading>
+ <span
+ class="op-ian-item--title"
+ [textContent]="text.loading"
+ ></span>
+ </ng-template>
+ <ng-container *ngIf="!workPackage$">
+ <span
+ class="op-ian-item--title"
+ [textContent]="notification.subject"
+ ></span>
+ </ng-container>
<div
- class="op-ian-item--actor"
- *ngIf="actor"
+ class="op-ian-item--actor"
+ *ngIf="actor"
>
<op-principal
- [hide-name]="false"
- [principal]="actor"
- size="medium"
+ [hide-name]="false"
+ [principal]="actor"
+ [link]="false"
+ size="medium"
+ class="op-principal_hide-name-on-mobile"
></op-principal>
</div>
<div
@@ -90,7 +90,7 @@
</ng-container>
</div>
</ng-container>
- <ul class="work-package-details-activities-messages" *ngIf="notification.details">
+ <ul class="work-package-details-activities-messages" *ngIf="notification.details.length > 1">
<ng-container *ngFor="let detail of details">
<li *ngIf="detail.html && detail.html !== ''">
<span
diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
index 0fa321d7d99..6697bb3a749 100644
--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass
@@ -1,11 +1,14 @@
@import "src/assets/sass/helpers"
+$ian-bg-color: #F9F9F9
+$ian-bg-hover-color: #F1F8FF
+
.op-ian-item
- background: #F9F9F9
- margin: 10px 0
+ background: $ian-bg-color
+ margin: 0 0 10px 0
padding: 5px 10px
- font-size: 1rem
- border: 1px solid #F1F1F1
+ font-size: 0.9rem
+ border: 1px solid var(--content-default-border-color)
border-radius: 2px
// This needs to be set in the itemSize of
// the virtual scroller
@@ -13,19 +16,29 @@
&_expanded
height: auto
-
- &:first-child
- margin-top: 0
+ display: grid
+ grid-template-rows: auto 1fr
+ grid-gap: 0.5rem
&:hover
- background: #F1F8FF
+ background: $ian-bg-hover-color
&--row
@include unset-button-styles
width: 100%
- display: flex
+ display: grid
+ grid-template-columns: 1fr 20% 15% 15%
+ grid-template-rows: 1fr 1fr
+ grid-template-areas: "project actor reason date" "title actor reason date"
+ grid-gap: 0.5rem
align-items: center
+ @media screen and (max-width: 679px)
+ grid-template-columns: 1fr 35px 30%
+ grid-template-rows: auto 1fr
+ grid-template-areas: "project actor reason" "title actor date"
+
+
&--indicator
width: 10px
height: 10px
@@ -41,23 +54,36 @@
font-weight: bold
&.-read
font-weight: normal
- &--message
- flex: 1
- display: flex
- flex-direction: column
- line-height: 1.1rem
&--project
+ grid-area: project
font-size: 0.8rem
color: var(--gray-dark)
+ @include text-shortener
&--reason,
- &--date,
- &--actor
- width: 15%
- flex-grow: 0
- text-align: right
+ &--date
+ color: var(--gray-dark)
+
+ &--title
+ grid-area: title
+ @include text-shortener
+
+ &--reason
+ grid-area: reason
+ @include text-shortener
+ max-width: 100%
+ @media screen and (max-width: 679px)
+ justify-self: end
- &--body
- padding: 0.5rem
- padding-left: 1.2rem
\ No newline at end of file
+ &--date
+ grid-area: date
+ justify-self: end
+ text-align: end
+ @include text-shortener(false)
+ white-space: nowrap
+ max-width: 100%
+
+ &--actor
+ grid-area: actor
+ @include text-shortener
diff --git a/frontend/src/app/shared/components/principal/principal-renderer.service.ts b/frontend/src/app/shared/components/principal/principal-renderer.service.ts
index 555af37a584..9d7ba9b4e70 100644
--- a/frontend/src/app/shared/components/principal/principal-renderer.service.ts
+++ b/frontend/src/app/shared/components/principal/principal-renderer.service.ts
@@ -91,6 +91,7 @@ export class PrincipalRendererService {
fallback.classList.add(`op-avatar_${options.size}`);
fallback.classList.add(`op-avatar_${type.replace('_', '-')}`);
fallback.classList.add('op-avatar--fallback');
+ fallback.title = principal.name;
fallback.textContent = userInitials;
if (type === 'placeholder_user') {
@@ -138,12 +139,14 @@ export class PrincipalRendererService {
link.textContent = principal.name;
link.href = this.principalURL(principal, type);
link.target = '_blank';
+ link.classList.add('op-principal--name');
return link;
}
const span = document.createElement('span');
span.textContent = principal.name;
+ span.classList.add('op-principal--name');
return span;
}
diff --git a/frontend/src/global_styles/content/_principal.sass b/frontend/src/global_styles/content/_principal.sass
index 667c913203c..9454fb22585 100644
--- a/frontend/src/global_styles/content/_principal.sass
+++ b/frontend/src/global_styles/content/_principal.sass
@@ -3,3 +3,7 @@
display: block
margin-bottom: 2px
+ &_hide-name-on-mobile &
+ @media screen and (max-width: 680px)
+ &--name
+ display: none
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 45c718001a4..ba1021a4988 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -126,7 +126,7 @@ module Redmine::MenuManager::TopMenuHelper
label: '',
label_options: { icon: 'icon-menu', title: I18n.t('label_modules') },
items: items,
- options: { drop_down_id: 'more-menu', drop_down_class: 'drop-down--modules ' }
+ options: { drop_down_id: 'more-menu', drop_down_class: 'drop-down--modules ', menu_item_class: 'hidden-for-mobile' }
)
end
end