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

Show "Mark as read" button in the full view

Henriette Dargeeb4962822c96
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 1c62709e04b..cf1af52e8c6 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -576,6 +576,7 @@ en:
all: 'All'
center:
mark_all_read: 'Mark all as read'
+ mark_as_read: 'Mark as read'
text_update_date: "%{date} by"
total_count_warning: "Showing the %{newest_count} most recent notifications. %{more_count} more are not displayed."
settings:
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.html b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.html
new file mode 100644
index 00000000000..589621eb936
--- /dev/null
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.html
@@ -0,0 +1,8 @@
+<button
+ (click)="markAllBelongingWPsAsRead()"
+ [attr.title]="text.mark_as_read"
+ [ngClass]="buttonClasses"
+ class="button">
+
+ <op-icon icon-classes="button--icon icon-mark-read"></op-icon>
+</button>
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts
new file mode 100644
index 00000000000..3628a7aaaa2
--- /dev/null
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component.ts
@@ -0,0 +1,30 @@
+import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { InAppNotificationsService } from 'core-app/features/in-app-notifications/store/in-app-notifications.service';
+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+
+@Component({
+ selector: 'op-work-package-mark-notification-button',
+ templateUrl: './work-package-mark-notification-button.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class WorkPackageMarkNotificationButtonComponent {
+ @Input() public workPackage:WorkPackageResource;
+
+ @Input() public buttonClasses:string;
+
+ text = {
+ mark_as_read: this.I18n.t('js.notifications.center.mark_as_read'),
+ };
+
+ constructor(
+ private I18n:I18nService,
+ private ianService:InAppNotificationsService,
+ ) {
+ }
+
+ markAllBelongingWPsAsRead():void {
+ // TODO
+ this.ianService.markAllRead();
+ }
+}
diff --git a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
index 127098fcfc9..4e4e12e618c 100644
--- a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
+++ b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
@@ -171,6 +171,7 @@ import { WorkPackageFilterByTextInputComponent } from 'core-app/features/work-pa
import { FilterIntegerValueComponent } from 'core-app/features/work-packages/components/filters/filter-integer-value/filter-integer-value.component';
import { WorkPackageFilterContainerComponent } from 'core-app/features/work-packages/components/filters/filter-container/filter-container.directive';
import { FilterBooleanValueComponent } from 'core-app/features/work-packages/components/filters/filter-boolean-value/filter-boolean-value.component';
+import { WorkPackageMarkNotificationButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-mark-notification-button/work-package-mark-notification-button.component';
@NgModule({
imports: [
@@ -388,6 +389,8 @@ import { FilterBooleanValueComponent } from 'core-app/features/work-packages/com
WorkPackageSingleCardComponent,
WorkPackageViewToggleButtonComponent,
+ // Notifications
+ WorkPackageMarkNotificationButtonComponent,
],
exports: [
WorkPackagesTableComponent,
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
index 5e3c8367531..fbaa5c8ad90 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
@@ -50,6 +50,8 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
public displayWatchButton:boolean;
+ displayNotificationsButton = false;
+
public watchers:any;
stateName$ = of('work-packages.new');
@@ -84,6 +86,8 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
private setWorkPackageScopeProperties(wp:WorkPackageResource) {
this.isWatched = wp.hasOwnProperty('unwatch');
this.displayWatchButton = wp.hasOwnProperty('unwatch') || wp.hasOwnProperty('watch');
+ // TODO
+ this.displayNotificationsButton = true;
// watchers
if (wp.watchers) {
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
index 609c58c660a..9697077b46c 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
@@ -30,6 +30,13 @@
[showText]="false">
</wp-watcher-button>
</li>
+ <li class="toolbar-item" *ngIf="displayNotificationsButton">
+ <op-work-package-mark-notification-button
+ [workPackage]="workPackage"
+ buttonClasses="toolbar-icon"
+ >
+ </op-work-package-mark-notification-button>
+ </li>
<li class="toolbar-item hidden-for-mobile">
<zen-mode-toggle-button>
</zen-mode-toggle-button>