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

Clean-up & add translations

Dmitrii4454f443d68e
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 9fcaaf32326..a6435bb5c8d 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -661,6 +661,9 @@ en:
date_alerts:
title: 'Date alerts'
description: 'Automatic notifications when important dates are approaching for open work packages you are involved in (assignee, accountable or watcher)'
+ start_date: Start Date
+ due_date: Finish Date
+ overdue: When Overdue
project_specific:
title: 'Project-specific notification settings'
description: 'These project-specific settings override default settings above'
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
index 8f6ac0f4d4f..0c34d344dec 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html
@@ -53,26 +53,27 @@
/>
</spot-selector-field>
- <h5>Date alerts</h5>
+ <h5>{{ text.dateAlerts.title }}</h5>
+ <p>{{ text.dateAlerts.description }}</p>
<div
- class="op-reminder-settings-daily-time--row"
+ class="op-reminder-settings-date-alerts--row"
formGroupName="startDate"
>
<input
type="checkbox"
formControlName="active"
- class="op-reminder-settings-daily-time--active"
+ class="op-reminder-settings-date-alerts--active"
attr.data-qa-selector="op-settings-start-date"
/>
<label
- class="op-reminder-settings-daily-time--label"
+ class="op-reminder-settings-date-alerts--label"
[textContent]="text.startDate"
- attr.for="op-reminder-settings-daily-time"
+ attr.for="op-reminder-settings-date-alerts"
></label>
<select
formControlName="time"
- class="op-reminder-settings-daily-time--time form--select -narrow"
- attr.id="op-reminder-settings-daily-time"
+ class="op-reminder-settings-date-alerts--time form--select -narrow"
+ attr.id="op-reminder-settings-date-alerts"
required="true"
>
<option
@@ -85,24 +86,24 @@
</div>
<div
- class="op-reminder-settings-daily-time--row"
+ class="op-reminder-settings-date-alerts--row"
formGroupName="dueDate"
>
<input
type="checkbox"
formControlName="active"
- class="op-reminder-settings-daily-time--active"
+ class="op-reminder-settings-date-alerts--active"
attr.data-qa-selector="op-settings-start-date"
/>
<label
- class="op-reminder-settings-daily-time--label"
+ class="op-reminder-settings-date-alerts--label"
[textContent]="text.dueDate"
- attr.for="op-reminder-settings-daily-time"
+ attr.for="op-reminder-settings-date-alerts"
></label>
<select
formControlName="time"
- class="op-reminder-settings-daily-time--time form--select -narrow"
- attr.id="op-reminder-settings-daily-time"
+ class="op-reminder-settings-date-alerts--time form--select -narrow"
+ attr.id="op-reminder-settings-date-alerts"
required="true"
>
<option
@@ -114,23 +115,23 @@
</div>
<div
- class="op-reminder-settings-daily-time--row"
+ class="op-reminder-settings-date-alerts--row"
formGroupName="overdue"
>
<input
formControlName="active"
type="checkbox"
- class="op-reminder-settings-daily-time--active"
+ class="op-reminder-settings-date-alerts--active"
attr.data-qa-selector="op-settings-start-date">
<label
- class="op-reminder-settings-daily-time--label"
+ class="op-reminder-settings-date-alerts--label"
[textContent]="text.overdue"
- attr.for="op-reminder-settings-daily-time"
+ attr.for="op-reminder-settings-date-alerts"
></label>
<select
formControlName="time"
- class="op-reminder-settings-daily-time--time form--select -narrow"
- attr.id="op-reminder-settings-daily-time"
+ class="op-reminder-settings-date-alerts--time form--select -narrow"
+ attr.id="op-reminder-settings-date-alerts"
required="true"
>
<option
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass
index 5b5928e358d..50bd81f7ad9 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.sass
@@ -1,6 +1,6 @@
@import "helpers"
-.op-reminder-settings-daily-time
+.op-reminder-settings-date-alerts
&--enable
display: flex
align-items: center
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
index 70b10d84379..282c589952f 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
@@ -55,6 +55,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
@Input() userId:string;
public availableTimes = REMINDER_AVAILABLE_TIMEFRAMES;
+
public availableTimesOverdue = OVERDUE_REMINDER_AVAILABLE_TIMEFRAMES;
public form = new FormGroup({
@@ -110,9 +111,9 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
},
assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
- startDate: 'Start Date',
- dueDate: 'Finish Date',
- overdue: 'When Overdue',
+ startDate: this.I18n.t('js.notifications.settings.global.start_date'),
+ dueDate: this.I18n.t('js.notifications.settings.global.due_date'),
+ overdue: this.I18n.t('js.notifications.settings.global.overdue'),
};
constructor(
@@ -127,7 +128,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
ngOnInit():void {
this.form.disable();
- this.userId = this.userId || this.uiRouterGlobals.params.userId;
+ this.userId = (this.userId || this.uiRouterGlobals.params.userId) as string;
this
.currentUserService
.user$
@@ -138,7 +139,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
});
this.form.get('startDate.active')?.valueChanges.subscribe((newValue) => {
- const timeCtrl = this.form.get('startDate.time')!
+ const timeCtrl = this.form.get('startDate.time')!;
if (!newValue) {
timeCtrl.disable();
} else {
@@ -147,7 +148,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
});
this.form.get('dueDate.active')?.valueChanges.subscribe((newValue) => {
- const timeCtrl = this.form.get('dueDate.time')!
+ const timeCtrl = this.form.get('dueDate.time')!;
if (!newValue) {
timeCtrl.disable();
} else {
@@ -156,7 +157,7 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
});
this.form.get('overdue.active')?.valueChanges.subscribe((newValue) => {
- const timeCtrl = this.form.get('overdue.time')!
+ const timeCtrl = this.form.get('overdue.time')!;
if (!newValue) {
timeCtrl.disable();
} else {
@@ -187,8 +188,6 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
this.form.get('overdue.active')?.setValue(!!settings.overdue);
this.form.get('overdue.time')?.setValue(settings.overdue || this.availableTimesOverdue[0].value);
-
- this.form.enable();
});
this.storeService.query.projectNotifications$
@@ -221,19 +220,11 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
this.form.setControl('projectSettings', projectSettings);
this.changeDetectorRef.detectChanges();
});
- }
-
- isActive(attributeName:string):boolean {
- return (this.form.get(attributeName)!.value || '').length > 0;
- }
- changeTime(newTime:string, attributeName:string):void {
- // console.log(newTime)
- this.form.get(attributeName)?.setValue(newTime);
+ this.form.enable();
}
public saveChanges():void {
- // debugger
const prefs = this.storeService.store.getValue();
const notificationSettings = (this.form.value as IFullNotificationSettingsValue);
const globalNotification = prefs.notifications.find((notification) => !notification._links.project.href) as INotificationSetting;
@@ -249,9 +240,9 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
workPackageScheduled: notificationSettings.workPackageScheduled,
workPackagePrioritized: notificationSettings.workPackagePrioritized,
workPackageCommented: notificationSettings.workPackageCommented,
- startDate: this.form.get('startDate.active')!.value ? this.form.get('startDate.time')!.value : null,
- dueDate: this.form.get('dueDate.active')!.value ? this.form.get('dueDate.time')!.value : null,
- overdue: this.form.get('overdue.active')!.value ? this.form.get('overdue.time')!.value : null,
+ startDate: this.form.get('startDate.active')!.value ? (this.form.get('startDate.time')!.value) as string : null,
+ dueDate: this.form.get('dueDate.active')!.value ? (this.form.get('dueDate.time')!.value) as string : null,
+ overdue: this.form.get('overdue.active')!.value ? (this.form.get('overdue.time')!.value) as string : null,
};
const projectPrefs:INotificationSetting[] = notificationSettings.projectSettings.map((settings) => ({
@@ -273,12 +264,9 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
wikiPageUpdated: false,
membershipAdded: false,
membershipUpdated: false,
-
- // Angular cannot handle null values in select options. It will only return string values.
- // In fact, setting `undefined` will return `"undefined"` as the value!
- startDate: settings.startDate === "null" ? null : settings.startDate,
- dueDate: settings.dueDate === "null" ? null : settings.dueDate,
- overdue: settings.overdue === "null" ? null : settings.overdue,
+ startDate: settings.startDate,
+ dueDate: settings.dueDate,
+ overdue: settings.overdue,
}));
this.storeService.update(this.userId, {
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
index 6d9b62b13a8..6e6e3742bcc 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.html
@@ -81,8 +81,8 @@
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- <h5>{{ text.alsoNotifyFor.title }}</h5>
- <p>{{ text.alsoNotifyFor.description }}</p>
+ <h5>{{ text.dateAlerts.title }}</h5>
+ <p>{{ text.dateAlerts.description }}</p>
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell"></td>
@@ -91,18 +91,18 @@
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- Start date
+ {{ text.startDate }}
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell" [formGroup]="item">
<select
formControlName="startDate"
- class="form--select -narrow"
+ class="form--select"
required="true"
>
<option
*ngFor="let availableTime of availableTimes"
- [value]="availableTime.value"
+ [ngValue]="availableTime.value"
>
{{availableTime.title}}
</option>
@@ -113,18 +113,18 @@
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- Due date
+ {{ text.dueDate }}
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell" [formGroup]="item">
<select
formControlName="dueDate"
- class="form--select -narrow"
+ class="form--select"
required="true"
>
<option
*ngFor="let availableTime of availableTimes"
- [value]="availableTime.value"
+ [ngValue]="availableTime.value"
>
{{availableTime.title}}
</option>
@@ -135,18 +135,18 @@
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- Overdue
+ {{ text.overdue }}
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell" [formGroup]="item">
<select
formControlName="overdue"
- class="form--select -narrow"
+ class="form--select"
required="true"
>
<option
*ngFor="let availableTime of availableTimesOverdue"
- [value]="availableTime.value"
+ [ngValue]="availableTime.value"
>
{{availableTime.title}}
</option>
@@ -157,8 +157,8 @@
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
- <h5>Some header</h5>
- <p>Some text<p>
+ <h5>{{ text.alsoNotifyFor.title }}</h5>
+ <p>{{ text.alsoNotifyFor.description }}<p>
</th>
<ng-container *ngFor="let item of settings.controls">
<td class="op-table--cell"></td>
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
index 01e9a208d08..9d02ccb31e1 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
@@ -25,18 +25,15 @@ export class NotificationSettingsTableComponent {
public availableTimes = [
{
- // null is not handled well by angular as a option value, it will always return a string.
- // We might as well make this obvious
- value: "null",
+ value: null,
title: this.I18n.t('js.notifications.settings.reminders.no_notification'),
},
...REMINDER_AVAILABLE_TIMEFRAMES,
];
+
public availableTimesOverdue = [
{
- // null is not handled well by angular as a option value, it will always return a string.
- // We might as well make this obvious
- value: "null",
+ value: null,
title: this.I18n.t('js.notifications.settings.reminders.no_notification'),
},
...OVERDUE_REMINDER_AVAILABLE_TIMEFRAMES,
@@ -57,6 +54,10 @@ export class NotificationSettingsTableComponent {
title: this.I18n.t('js.notifications.settings.global.delayed.title'),
description: this.I18n.t('js.notifications.settings.global.delayed.description'),
},
+ dateAlerts: {
+ title: this.I18n.t('js.notifications.settings.global.date_alerts.title'),
+ description: this.I18n.t('js.notifications.settings.global.date_alerts.description'),
+ },
assignee: this.I18n.t('js.notifications.settings.reasons.assignee'),
responsible: this.I18n.t('js.notifications.settings.reasons.responsible'),
watched_header: this.I18n.t('js.notifications.settings.reasons.watched'),
@@ -66,6 +67,9 @@ export class NotificationSettingsTableComponent {
work_package_prioritized_header: this.I18n.t('js.notifications.settings.reasons.work_package_prioritized'),
work_package_scheduled_header: this.I18n.t('js.notifications.settings.reasons.work_package_scheduled'),
remove_project_settings: this.I18n.t('js.notifications.settings.project_specific.remove'),
+ startDate: this.I18n.t('js.notifications.settings.global.start_date'),
+ dueDate: this.I18n.t('js.notifications.settings.global.due_date'),
+ overdue: this.I18n.t('js.notifications.settings.global.overdue'),
};
constructor(