Skip to content

Commit

Permalink
Reformat some code to ease code review
Browse files Browse the repository at this point in the history
  • Loading branch information
abelgomez committed Oct 10, 2024
1 parent 1565c95 commit 9f98a70
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ export class ItemPageCcLicenseFieldComponent implements OnInit {
*/
@Input() item: Item;

/**
* Field name containing the CC license URI
/**
* 'full' variant shows image, a disclaimer (optional) and name (always), better for the item page content.
* 'small' variant shows image and name (optional), better for the item page sidebar
*/
@Input() ccLicenseUriField?;
@Input() variant?: 'small' | 'full' = this.appConfig.ccLicense.variant;

/**
/**
* Field name containing the CC license URI
*/
@Input() ccLicenseNameField?;
@Input() ccLicenseUriField?;

/**
* 'full' variant shows image, a disclaimer (optional) and name (always), better for the item page content.
* 'small' variant shows image and name (optional), better for the item page sidebar
* Field name containing the CC license URI
*/
@Input() variant?: 'small' | 'full' = this.appConfig.ccLicense.variant;
@Input() ccLicenseNameField?;

/**
* Shows the CC license name with the image. Always show if image fails to load
Expand All @@ -64,6 +64,11 @@ export class ItemPageCcLicenseFieldComponent implements OnInit {
*/
@Input() showDisclaimer? = this.appConfig.ccLicense.showDisclaimer;

/**
* Expression used to detect (and parse) whether a URI denotes a CC license
*/
public static readonly regex = /.*creativecommons.org\/(licenses|publicdomain)\/([^/]+)/gm;

Check failure on line 70 in src/app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Member regex should be declared before all instance field definitions

Check failure on line 70 in src/app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Member regex should be declared before all instance field definitions

uri: string;
name: string;
showImage = true;
Expand All @@ -76,7 +81,6 @@ export class ItemPageCcLicenseFieldComponent implements OnInit {
}

Check failure on line 82 in src/app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component.ts

View workflow job for this annotation

GitHub Actions / tests (18.x)

Trailing spaces not allowed

Check failure on line 82 in src/app/item-page/simple/field-components/specific-field/cc-license/item-page-cc-license-field.component.ts

View workflow job for this annotation

GitHub Actions / tests (20.x)

Trailing spaces not allowed
ngOnInit() {
const regex = /.*creativecommons.org\/(licenses|publicdomain)\/([^/]+)/gm;

this.configService.findByPropertyName('cc.license.uri').pipe(
getFirstCompletedRemoteData(),
Expand Down

0 comments on commit 9f98a70

Please sign in to comment.