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

Initial work on notification settings frontend

Benjamin Bädorf13228823b015
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 f1248ead9d3..0e340d8da0d 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
@@ -1,16 +1,140 @@
<op-notifications-settings-toolbar></op-notifications-settings-toolbar>
-<op-notification-settings-table
+<form
+ [formGroup]="form"
+ (ngSubmit)="saveChanges()"
+>
+ <h2>Notify me immediately</h2>
+ <p>These settings apply to all projects. You can create project-specific exceptions below.</p>
+
+ <div class="op-form-field op-form-field_checkbox">
+ <label class="op-form-field--label-wrap">
+ <div class="op-form-field--label">I am @mentioned</div>
+ <input
+ disabled
+ checked
+ type="checkbox"
+ />
+ </label>
+ <div class="op-form-field--description">
+ <p slot="description">Receive a notification every time someone mentions me anywhere</p>
+ </div>
+ </div>
+
+ <op-form-field
+ label="Assigned to me or accountable"
+ [checkbox]="true"
+ [control]="form.get('assignedToMeOrAccountable')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="assignedToMeOrAccountable"
+ />
+ <p slot="description">
+ Receive notifications for all activities on work packages for which I am assignee or accountable.
+ </p>
+ </op-form-field>
+
+ <h2>Also notify me for</h2>
+ <p>Receive notifications for these activities on work packages in all projects:</p>
+
+ <div class="op-form-field op-form-field_checkbox">
+ <label class="op-form-field--label-wrap">
+ <input
+ disabled
+ checked
+ type="checkbox"
+ />
+ </label>
+ <div class="op-form-field--description">
+ <p slot="description">Updates on watched items</p>
+ </div>
+ </div>
+
+ <op-form-field
+ [checkbox]="true"
+ [control]="form.get('newWorkPackages')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="newWorkPackages"
+ />
+ <p slot="description">New work packages</p>
+ </op-form-field>
+
+ <op-form-field
+ [checkbox]="true"
+ [control]="form.get('allStatusChanges')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="allStatusChanges"
+ />
+ <p slot="description">All status changes</p>
+ </op-form-field>
+
+ <op-form-field
+ [checkbox]="true"
+ [control]="form.get('allDateChanges')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="allDateChanges"
+ />
+ <p slot="description">All date changes</p>
+ </op-form-field>
+
+ <op-form-field
+ [checkbox]="true"
+ [control]="form.get('allPriorityChanges')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="allPriorityChanges"
+ />
+ <p slot="description">All priority changes</p>
+ </op-form-field>
+
+ <op-form-field
+ [checkbox]="true"
+ [control]="form.get('allNewComments')"
+ [noWrapLabel]="false"
+ >
+ <input
+ slot="input"
+ type="checkbox"
+ formControlName="allNewComments"
+ />
+ <p slot="description">All new comments</p>
+ </op-form-field>
+
+ <hr />
+
+ <h2>Project-specific notification settings</h2>
+ <p>These project-specific settings override default settings above</p>
+
+ <op-notification-settings-table
*ngIf="userId"
[userId]="userId"
-></op-notification-settings-table>
+ ></op-notification-settings-table>
+
+ <
-<div class="generic-table--action-buttons">
- <button
+ <div class="generic-table--action-buttons">
+ <button
class="button -highlight"
[textContent]="text.save"
- (click)="saveChanges()"
- >
- </button>
-</div>
-
+ type="submit"
+ ></button>
+ </div>
+</form>
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 e40c6983eae..d5438cc1840 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
@@ -1,6 +1,14 @@
import {
- ChangeDetectionStrategy, Component, Input, OnInit,
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ OnInit,
} from '@angular/core';
+import {
+ FormGroup,
+ FormControl,
+ Validators,
+} from '@angular/forms';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
import { take } from 'rxjs/internal/operators/take';
@@ -18,6 +26,15 @@ export const myNotificationsPageComponentSelector = 'op-notifications-page';
export class NotificationsSettingsPageComponent implements OnInit {
@Input() userId:string;
+ public form = new FormGroup({
+ assignedToMeOrAccountable: new FormControl(false, []),
+ newWorkPackages: new FormControl(false, []),
+ allStatusChanges: new FormControl(false, []),
+ allDateChanges: new FormControl(false, []),
+ allPriorityChanges: new FormControl(false, []),
+ allNewComments: new FormControl(false, []),
+ });
+
text = {
save: this.I18n.t('js.button_save'),
email: this.I18n.t('js.notifications.email'),
diff --git a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-field-wrapper/dynamic-field-wrapper.component.html b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-field-wrapper/dynamic-field-wrapper.component.html
index 45b3ed4acf6..20f71264646 100644
--- a/frontend/src/app/shared/components/dynamic-forms/components/dynamic-field-wrapper/dynamic-field-wrapper.component.html
+++ b/frontend/src/app/shared/components/dynamic-forms/components/dynamic-field-wrapper/dynamic-field-wrapper.component.html
@@ -4,11 +4,11 @@
[hidden]="field?.hide"
[noWrapLabel]="to?.noWrapLabel"
[required]="to?.required"
+ [checkbox]="field.type === 'booleanInput'"
[helpTextAttribute]="to?.property"
[helpTextAttributeScope]="to?.helpTextAttributeScope || dynamicFormComponent?.helpTextAttributeScope"
[showValidationErrorOn]="to?.showValidationErrorOn || dynamicFormComponent?.showValidationErrorsOn"
[attr.data-qa-field-name]="to?.property"
- [ngClass]="{ 'op-form-field_checkbox': field.type === 'booleanInput' }"
>
<ng-container #fieldComponent slot="input"></ng-container>
diff --git a/frontend/src/app/shared/components/forms/form-field/form-field.component.ts b/frontend/src/app/shared/components/forms/form-field/form-field.component.ts
index ab9209792d8..1f374d89b00 100644
--- a/frontend/src/app/shared/components/forms/form-field/form-field.component.ts
+++ b/frontend/src/app/shared/components/forms/form-field/form-field.component.ts
@@ -14,12 +14,18 @@ export class OpFormFieldComponent {
return this.showErrorMessage;
}
+ @HostBinding('class.op-form-field_checkbox') get checkboxClassName() {
+ return this.checkbox;
+ }
+
@Input() label = '';
- @Input() noWrapLabel = true;
+ @Input() noWrapLabel = false;
@Input() required = false;
+ @Input() checkbox = false;
+
@Input() hidden = false;
@Input() showValidationErrorOn:'change' | 'blur' | 'submit' | 'never' = 'submit';
diff --git a/frontend/src/app/shared/components/popout/popout.component.html b/frontend/src/app/shared/components/popout/popout.component.html
new file mode 100644
index 00000000000..f30360cb9d6
--- /dev/null
+++ b/frontend/src/app/shared/components/popout/popout.component.html
@@ -0,0 +1,4 @@
+<ng-content select="[slot=trigger]"></ng-content>
+<div class="op-dropout--wrapper">
+ <ng-content select="[slot=trigger]"></ng-content>
+</div>
diff --git a/frontend/src/app/shared/components/popout/popout.component.ts b/frontend/src/app/shared/components/popout/popout.component.ts
new file mode 100644
index 00000000000..c1a52c3fe51
--- /dev/null
+++ b/frontend/src/app/shared/components/popout/popout.component.ts
@@ -0,0 +1,20 @@
+import {
+ Component,
+ HostBinding,
+} from '@angular/core';
+
+@Component({
+ selector: 'op-dropout',
+ templateUrl: './dropout.component.html',
+})
+export class OpDropoutComponent {
+ @HostBinding('class.op-dropout') className = true;
+
+ @HostBinding('class.op-dropout_opened') get openedClassName() {
+ return this.opened;
+ }
+
+ public opened = false;
+
+ constructor() {}
+}
diff --git a/frontend/src/app/shared/components/popout/popout.sass b/frontend/src/app/shared/components/popout/popout.sass
new file mode 100644
index 00000000000..adeaa2b3d81
--- /dev/null
+++ b/frontend/src/app/shared/components/popout/popout.sass
@@ -0,0 +1,2 @@
+.op-dropout
+ display: inline-flex
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index 86da3fc8391..8644d227b5a 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -70,6 +70,7 @@ import { ShowSectionDropdownComponent } from './components/hide-section/show-sec
import { SlideToggleComponent } from './components/slide-toggle/slide-toggle.component';
import { DynamicBootstrapModule } from './components/dynamic-bootstrap/dynamic-bootstrap.module';
import { OpFormFieldComponent } from './components/forms/form-field/form-field.component';
+import { OpPopoutComponent } from './components/popout/popout.component';
import { OpFormBindingDirective } from './components/forms/form-field/form-binding.directive';
import { OpOptionListComponent } from './components/option-list/option-list.component';
@@ -174,6 +175,8 @@ export function bootstrapModule(injector:Injector) {
OpFormFieldComponent,
OpFormBindingDirective,
OpOptionListComponent,
+
+ OpPopoutComponent,
],
declarations: [
OpDateTimeComponent,
@@ -225,6 +228,8 @@ export function bootstrapModule(injector:Injector) {
OpFormFieldComponent,
OpFormBindingDirective,
OpOptionListComponent,
+
+ OpPopoutComponent,
],
})
export class OPSharedModule {
diff --git a/frontend/src/global_styles/common/openproject-common.module.sass b/frontend/src/global_styles/common/openproject-common.module.sass
index b334c68eb6b..cbd19b0d606 100644
--- a/frontend/src/global_styles/common/openproject-common.module.sass
+++ b/frontend/src/global_styles/common/openproject-common.module.sass
@@ -5,5 +5,6 @@
@import 'bubble/bubble'
@import '../../app/shared/components/forms'
@import '../../app/shared/components/option-list/option-list'
+@import '../../app/shared/components/dropout/dropout'
@import 'export-options/export-options'
@import 'select/select'