Skip to content

Commit

Permalink
The license labels are loaded in the same way than in the clarin item…
Browse files Browse the repository at this point in the history
… view box.
  • Loading branch information
milanmajchrak committed Oct 5, 2023
1 parent 4ab1746 commit 573a21e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div>
<a [href]="licenseURI">{{license}}</a>
</div>
<div class="d-inline" *ngFor="let icon of licenseLabelIcons">
<div class="d-inline" *ngFor="let icon of (licenseLabelIcons | async)">
<img class="mr-1" [src]="secureImageData(icon)" alt="" width="24px">
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ClarinLicenseDataService } from '../../core/data/clarin/clarin-license-
import { ClarinLicense } from '../../core/shared/clarin/clarin-license.model';
import { DomSanitizer } from '@angular/platform-browser';
import { secureImageData } from '../../shared/clarin-shared-util';
import { BehaviorSubject } from 'rxjs';

/**
* This component show clarin license info in the item page and item full page.
Expand Down Expand Up @@ -50,7 +51,7 @@ export class ClarinLicenseInfoComponent implements OnInit {
/**
* Current License Label icon as byte array.
*/
licenseLabelIcons: any[] = [];
licenseLabelIcons: BehaviorSubject<any[]> = new BehaviorSubject<any[]>([]);

ngOnInit(): void {
// load license info from item attributes
Expand Down Expand Up @@ -83,9 +84,11 @@ export class ClarinLicenseInfoComponent implements OnInit {
getFirstCompletedRemoteData(),
switchMap((clList: RemoteData<PaginatedList<ClarinLicense>>) => clList?.payload?.page))
.subscribe(clarinLicense => {
let iconsList = [];
clarinLicense.extendedClarinLicenseLabels.forEach(extendedCll => {
this.licenseLabelIcons.push(extendedCll?.icon);
iconsList.push(extendedCll?.icon);
});
this.licenseLabelIcons.next(iconsList);
});
}

Expand Down

0 comments on commit 573a21e

Please sign in to comment.