Skip to content

Commit

Permalink
🤖 GITHUB ACTIONS format_prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
orcid-releaser committed Apr 17, 2024
1 parent d4f36e8 commit 8e18724
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,28 @@
id="cy-org-dd"
>
<ng-container id="cy-org-filtered-options">
<mat-option
[value]="affiliationForm.get('organization').value"
>
<mat-option [value]="affiliationForm.get('organization').value">
<div class="row orc-font-body-small title">
<i i18n="@@shared.useOrganizationName">Use this organization name</i>
<i i18n="@@shared.useOrganizationName"
>Use this organization name</i
>
</div>
<div class="row orc-font-small-print">
<ng-container i18n="@@shared.addLocationManually">You will need to add location information manually</ng-container>
<ng-container i18n="@@shared.addLocationManually"
>You will need to add location information
manually</ng-container
>
</div>
</mat-option>
<mat-option class="organization-identifiers" [disabled]="true" *ngIf="displayOrganizationOption" >
<mat-option
class="organization-identifiers"
[disabled]="true"
*ngIf="displayOrganizationOption"
>
<div class="row orc-font-body-large title">
<b i18n="@@shared.organizationWithIdentifiers">Organizations with identifiers</b>
<b i18n="@@shared.organizationWithIdentifiers"
>Organizations with identifiers</b
>
</div>
</mat-option>
<mat-option
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
@use '@angular/material' as mat;
@import 'src/assets/scss/material.orcid-theme.scss';

@mixin model-affiliation-theme($theme) {
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
$warn: map-get($theme, accent);
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);
$config: mat.define-legacy-typography-config();

input {
border: solid 1px mat.get-color-from-palette($background, grey);
}

::placeholder {
color: mat.get-color-from-palette($background, placeholder-grey);
}

:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: mat.get-color-from-palette($background, placeholder-grey);
}

.error {
color: map-get($foreground, 'state-warning-dark');
}

.required {
color: map-get($foreground, 'state-warning-dark');
}

input.mat-input-element {
border: transparent;
font-size: mat.font-size($config, body-1) !important;
}

.mat-select {
font-size: mat.font-size($config, body-1) !important;
}

.organization-identifiers {
color: $orcid-dark-primary-text;
border-color: mat.get-color-from-palette(
$background,
ui-background
) !important;
}
}
@include model-affiliation-theme($orcid-app-theme);
@use '@angular/material' as mat;
@import 'src/assets/scss/material.orcid-theme.scss';

@mixin model-affiliation-theme($theme) {
$primary: map-get($theme, primary);
$accent: map-get($theme, accent);
$warn: map-get($theme, accent);
$foreground: map-get($theme, foreground);
$background: map-get($theme, background);
$config: mat.define-legacy-typography-config();

input {
border: solid 1px mat.get-color-from-palette($background, grey);
}

::placeholder {
color: mat.get-color-from-palette($background, placeholder-grey);
}

:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: mat.get-color-from-palette($background, placeholder-grey);
}

.error {
color: map-get($foreground, 'state-warning-dark');
}

.required {
color: map-get($foreground, 'state-warning-dark');
}

input.mat-input-element {
border: transparent;
font-size: mat.font-size($config, body-1) !important;
}

.mat-select {
font-size: mat.font-size($config, body-1) !important;
}

.organization-identifiers {
color: $orcid-dark-primary-text;
border-color: mat.get-color-from-palette(
$background,
ui-background
) !important;
}
}
@include model-affiliation-theme($orcid-app-theme);
Original file line number Diff line number Diff line change
Expand Up @@ -458,56 +458,53 @@ export class ModalAffiliationsComponent implements OnInit, OnDestroy {
}

filterOrganizations(): Observable<Organization[]> {
return this.affiliationForm
.get('organization')
.valueChanges.pipe(
tap((organization: string | Organization) => {
// Auto fill form when the user select an organization from the autocomplete list
if (
typeof organization === 'object' &&
organization.disambiguatedAffiliationIdentifier
) {
this.selectedOrganizationFromDatabase = organization
this.requireOrganizationDisambiguatedDataOnRefresh = true
this.displayOrganizationHint = true
this.fillForm(organization)
}
if (!organization) {
if (this.selectedOrganizationFromDatabase) {
this.affiliationForm.patchValue({
city: '',
region: '',
country: '',
})
}
this.selectedOrganizationFromDatabase = undefined
this.requireOrganizationDisambiguatedDataOnRefresh = true
this.displayOrganizationHint = false
}
}),
switchMap((organization: string | Organization) => {
if (
typeof organization === 'string' &&
!this.selectedOrganizationFromDatabase
) {
// Display matching organization based on the user string input
this.displayOrganizationOption = false
return this._filter((organization as string) || '').pipe(
tap((organizationList) => {
if (organizationList.length > 0) {
this.displayOrganizationOption = true
}

this.displayOrganizationHint = true
})
)
} else {
// Do not display options once the user has selected an Organization
return of([])
return this.affiliationForm.get('organization').valueChanges.pipe(
tap((organization: string | Organization) => {
// Auto fill form when the user select an organization from the autocomplete list
if (
typeof organization === 'object' &&
organization.disambiguatedAffiliationIdentifier
) {
this.selectedOrganizationFromDatabase = organization
this.requireOrganizationDisambiguatedDataOnRefresh = true
this.displayOrganizationHint = true
this.fillForm(organization)
}
if (!organization) {
if (this.selectedOrganizationFromDatabase) {
this.affiliationForm.patchValue({
city: '',
region: '',
country: '',
})
}
})
)
this.selectedOrganizationFromDatabase = undefined
this.requireOrganizationDisambiguatedDataOnRefresh = true
this.displayOrganizationHint = false
}
}),
switchMap((organization: string | Organization) => {
if (
typeof organization === 'string' &&
!this.selectedOrganizationFromDatabase
) {
// Display matching organization based on the user string input
this.displayOrganizationOption = false
return this._filter((organization as string) || '').pipe(
tap((organizationList) => {
if (organizationList.length > 0) {
this.displayOrganizationOption = true
}

this.displayOrganizationHint = true
})
)
} else {
// Do not display options once the user has selected an Organization
return of([])
}
})
)
}

fillForm(organization: Organization) {
Expand All @@ -517,9 +514,9 @@ export class ModalAffiliationsComponent implements OnInit, OnDestroy {
country: this.countryCodes.find((x) => x.value === organization.country)
.key,
})
this.affiliationForm.get('organization').disable();
this.affiliationForm.get('organization').disable()
this.disable(organization?.city, 'city')
this.affiliationForm.get('region').disable();
this.affiliationForm.get('region').disable()
this.disable(organization?.country, 'country')
}

Expand All @@ -528,7 +525,7 @@ export class ModalAffiliationsComponent implements OnInit, OnDestroy {
organization: '',
city: '',
region: '',
country: ''
country: '',
})
this.enable('organization')
this.enable('city')
Expand Down Expand Up @@ -597,12 +594,12 @@ export class ModalAffiliationsComponent implements OnInit, OnDestroy {

private disable(value: string, element: string): void {
if (value) {
this.affiliationForm.get(element).disable();
this.affiliationForm.get(element).disable()
}
}

private enable(element: string): void {
this.affiliationForm.get(element).enable();
this.affiliationForm.get(element).enable()
}

closeEvent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,19 +690,28 @@ <h2 class="orc-font-body" i18n="@@funding.agency">Funding agency</h2>
#auto="matAutocomplete"
[displayWith]="autoCompleteDisplayOrganization"
>
<mat-option
[value]="fundingForm.get('agencyName').value"
>
<mat-option [value]="fundingForm.get('agencyName').value">
<div class="row orc-font-body-small title">
<i i18n="@@shared.useOrganizationName">Use this organization name</i>
<i i18n="@@shared.useOrganizationName"
>Use this organization name</i
>
</div>
<div class="row orc-font-small-print">
<ng-container i18n="@@shared.addLocationManually">You will need to add location information manually</ng-container>
<ng-container i18n="@@shared.addLocationManually"
>You will need to add location information
manually</ng-container
>
</div>
</mat-option>
<mat-option class="organization-identifiers" [disabled]="true" *ngIf="displayOrganizationOption" >
<mat-option
class="organization-identifiers"
[disabled]="true"
*ngIf="displayOrganizationOption"
>
<div class="row orc-font-body-large title">
<b i18n="@@shared.organizationWithIdentifiers">Organizations with identifiers</b>
<b i18n="@@shared.organizationWithIdentifiers"
>Organizations with identifiers</b
>
</div>
</mat-option>
<mat-option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@ export class ModalFundingComponent implements OnInit, OnDestroy {
country: this.countryCodes.find((x) => x.value === organization.country)
.key,
})
this.fundingForm.get('agencyName').disable();
this.fundingForm.get('agencyName').disable()
this.disable(organization?.city, 'city')
this.fundingForm.get('region').disable();
this.fundingForm.get('region').disable()
this.disable(organization?.country, 'country')
this.disambiguatedFundingSourceId = organization.sourceId
this.disambiguatedFundingSource = organization.sourceType
Expand Down Expand Up @@ -672,12 +672,12 @@ export class ModalFundingComponent implements OnInit, OnDestroy {

private disable(value: string, element: string): void {
if (value) {
this.fundingForm.get(element).disable();
this.fundingForm.get(element).disable()
}
}

private enable(element: string): void {
this.fundingForm.get(element).enable();
this.fundingForm.get(element).enable()
}

private checkGrantsChanges(index: number) {
Expand Down

0 comments on commit 8e18724

Please sign in to comment.