79597: Add alt text to ds-thumbnail

This commit is contained in:
Yura Bondarenko
2021-05-25 09:28:02 +02:00
parent f85a5e65ad
commit 55affdebce
4 changed files with 38 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<div class="thumbnail">
<img [src]="src | dsSafeUrl" (error)="errorHandler()" class="img-fluid"/>
<img [src]="src | dsSafeUrl" [alt]="alt | translate" (error)="errorHandler()" class="img-fluid"/>
</div>

View File

@@ -1,3 +1,31 @@
img {
max-width: 100%;
}
.outer { // .outer/.inner generated ~ https://ratiobuddy.com/
position: relative;
&:before {
display: block;
content: "";
width: 100%;
padding-top: (210 / 297) * 100%; // A4 ratio
}
> .inner {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
> .thumbnail-placeholder {
background: var(--bs-gray-100);
border: var(--bs-gray-200) 1px;
color: var(--bs-gray-600);
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
}
}

View File

@@ -18,7 +18,6 @@ export const THUMBNAIL_PLACEHOLDER = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20
templateUrl: './thumbnail.component.html'
})
export class ThumbnailComponent implements OnInit {
/**
* The thumbnail Bitstream
*/
@@ -34,6 +33,11 @@ export class ThumbnailComponent implements OnInit {
*/
src: string;
/**
* i18n key of thumbnail alt text
*/
@Input() alt? = 'thumbnail.default.alt';
/**
* Initialize the thumbnail.
* Use a default image if no actual image is available.

View File

@@ -3539,6 +3539,10 @@
"submission.workflow.tasks.pool.show-detail": "Show detail",
"thumbnail.default.alt": "Thumbnail Image",
"thumbnail.default.placeholder": "No Thumbnail Available",
"title": "DSpace",