Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

batch-fixes-4-dec #2104

Merged
merged 9 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/core/register2/register2.form-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function Register2FormAdapterMixin<T extends Constructor<any>>(base: T) {
return {
...StepA.value.personal,
...StepB.value.password,
...StepB.value.sendOrcidNews,
...StepC.value.sendOrcidNews,
...StepD.value.activitiesVisibilityDefault,
...StepD.value.termsOfUse,
...StepD.value.captcha,
Expand Down
1 change: 0 additions & 1 deletion src/app/register2/components/BaseForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export abstract class BaseForm implements ControlValueAccessor, AsyncValidator {
public onTouchedFunction
constructor() {}
writeValue(val: any): void {
console.log('writeValue', val)
if (val != null && val !== undefined && val !== '') {
this.form.setValue(val, { emitEvent: true })
// Trigger registerOnChange custom function by calling form.updateValueAndValidity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<ng-container *ngIf="recognizedError[errorCode] === 0">
<ng-container
*ngIf="recognizedError[errorCode] === 0 && !disableInlineAlreadyExistError"
>
<ng-container i18n="@@register.emailAlreadyExists"
>This email already exists in our system. Would you like to</ng-container
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ enum RegisterBackendErrors {
export class BackendErrorComponent implements OnInit {
recognizedError = RegisterBackendErrors
_errorCode: string
@Input() disableInlineAlreadyExistError = false

@Input()
set errorCode(errorCode: string) {
// This will change the string send by the backend into a code, to handle the error trough a code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:host {
max-width: 100%;
::ng-deep {
label {
white-space: initial;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h2 i18n="@@register.yourEmailAddresses" class="orc-font-body margin-top-12">
class="orc-font-small-print"
id="email-input-input-label"
[ngClass]="{
error: emailFormTouched && form.hasError('required', 'emails.email')
error: emailFormTouched && emails.controls.email.errors
}"
id="email-input-label"
i18n="@@register.primaryEmail"
Expand Down Expand Up @@ -124,8 +124,9 @@ <h2 i18n="@@register.yourEmailAddresses" class="orc-font-body margin-top-12">
</mat-error>
<mat-error
*ngIf="
this.emails.hasError('email', 'email') ||
this.emails.hasError('pattern', 'email')
emailFormTouched &&
(this.emails.hasError('email', 'email') ||
this.emails.hasError('pattern', 'email'))
"
i18n="@@register.invalidEmail2"
>
Expand All @@ -141,6 +142,7 @@ <h2 i18n="@@register.yourEmailAddresses" class="orc-font-body margin-top-12">
*ngFor="let error of this.emails.getError('backendError', 'email')"
>
<app-backend-error
[disableInlineAlreadyExistError]="true"
[errorCode]="error"
[value]="emails.get('email').value"
></app-backend-error>
Expand Down Expand Up @@ -173,7 +175,7 @@ <h2 i18n="@@register.yourEmailAddresses" class="orc-font-body margin-top-12">

<div>
<a
routerLink="/signin"
(click)="navigateToSignin(emails.get('email').value)"
i18n="@@register.signInToOrcidUsingThisEmail"
>
Sign in to ORCID using this email address</a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ import {
first,
startWith,
switchMap,
take,
} from 'rxjs/operators'
import { ReactivationService } from '../../../core/reactivation/reactivation.service'
import { ReactivationLocal } from '../../../types/reactivation.local'
import { BaseForm } from '../BaseForm'
import { ErrorStateMatcher } from '@angular/material/core'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
import { Router } from '@angular/router'
import { ApplicationRoutes } from 'src/app/constants'
export class MyErrorStateMatcher implements ErrorStateMatcher {
isErrorState(
control: FormControl | null,
Expand Down Expand Up @@ -87,7 +91,9 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
undefinedEmail: boolean
constructor(
private _register: Register2Service,
private _reactivationService: ReactivationService
private _reactivationService: ReactivationService,
private _platform: PlatformInfoService,
private _router: Router
) {
super()
}
Expand Down Expand Up @@ -262,4 +268,17 @@ export class FormPersonalComponent extends BaseForm implements OnInit {
get emailsAreValid() {
return this.emailConfirmationValid && this.emailValid
}

navigateToSignin(email) {
this._platform
.get()
.pipe(take(1))
.subscribe((platform) => {
return this._router.navigate([ApplicationRoutes.signin], {
// keeps all parameters to support Oauth request
// and set show login to true
queryParams: { ...platform.queryParameters, email, show_login: true },
})
})
}
}
9 changes: 0 additions & 9 deletions src/app/register2/components/register2.scss-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@
}
}

:host {
::ng-deep {
.container .mat-horizontal-content-container,
.container {
background-color: map-get($background, 'ui-background-lightest');
}
}
}

::ng-deep {
.valid-password-input {
mat-icon {
Expand Down
4 changes: 4 additions & 0 deletions src/app/register2/components/register2.style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ mat-label.orc-font-small-print {
}

:host ::ng-deep {
mat-card {
margin-top: 32px !important;
}

mat-error {
margin-top: 8px;
font-size: 12px;
Expand Down
3 changes: 2 additions & 1 deletion src/app/register2/pages/register/register2.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#stepper
labelPosition="bottom"
class="orcid-stepper-wizard"
(selectionChange)="selectionChange($event)"
>
<mat-step [stepControl]="FormGroupStepA">
<ng-template matStepLabel i18n="@@register.personalData"
Expand Down Expand Up @@ -46,7 +47,7 @@
>Visibility and terms</ng-template
>
<app-step-d
#stepComponentC
#stepComponentD
[(formGroup)]="FormGroupStepD"
(submit)="register()"
[loading]="loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
$warn: map-get($theme, accent);
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);

:host {
background-color: map-get($background, 'ui-background-lightest');
}
}
@include theme($orcid-app-theme);
5 changes: 5 additions & 0 deletions src/app/register2/pages/register/register2.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ export class Register2Component implements OnInit, AfterViewInit {
}
}
}
selectionChange(event: StepperSelectionEvent) {
if (this.platform.columns4 || this.platform.columns8) {
this.focusCurrentStep(event)
}
}

// Fix to material vertical stepper not focusing current header
// related issue https://github.com/angular/components/issues/8881
Expand Down