Commit 55f7fa87 authored by Marcelo Rivera's avatar Marcelo Rivera
Browse files

(fix): added jsdoc

(fix): cleanup
parent 1bc00288
Pipeline #106617401 failed with stages
in 26 minutes and 56 seconds
......@@ -13,16 +13,17 @@
>
<img
[src]="getThumbnailSrc(entity$ | async)"
(click)="clickedImage(entity, this)"
(click)="clickedImage(entity, $event)"
/>
<i
*ngIf="attachment.shouldBeBlurred(entity)"
class="material-icons mature-icon"
>explicit</i
>
<i *ngIf="isUnlisted(entity)" class="material-icons unlisted-icon"
>visibility_off</i
>
explicit
</i>
<i *ngIf="isUnlisted(entity)" class="material-icons unlisted-icon">
visibility_off
</i>
</a>
</ng-container>
</div>
......@@ -17,8 +17,7 @@ export class NewsfeedTilesComponent {
constructor(
public attachment: AttachmentService,
private router: Router,
private overlayModalService: OverlayModalService,
private featuresService: FeaturesService
private overlayModalService: OverlayModalService
) {}
getThumbnailSrc(entity: any) {
......@@ -48,7 +47,11 @@ export class NewsfeedTilesComponent {
return entity && (entity.access_id === '0' || entity.access_id === 0);
}
clickedImage(entity: any, batchImage) {
/**
* @param entity
* @param event
*/
clickedImage(entity: any, event: MouseEvent) {
const isNotTablet = Math.min(screen.width, screen.height) < 768;
const pageUrl = `/media/${entity.entity_guid}`;
......@@ -57,22 +60,12 @@ export class NewsfeedTilesComponent {
return;
}
if (!this.featuresService.has('media-modal')) {
this.router.navigate([pageUrl]);
return;
} else {
if (entity.width === '0' || entity.height === '0') {
this.setImageDimensions(entity, batchImage);
}
this.openModal(entity);
if (entity.width === '0' || entity.height === '0') {
this.setImageDimensions(entity, event.target as HTMLImageElement);
}
this.openModal(entity);
}
// setVideoDimensions($event) {
// this.videoDimensions = $event.dimensions;
// entity.custom_data.dimensions = videoDimensions;
// }
setImageDimensions(entity, imageElement: HTMLImageElement) {
const img: HTMLImageElement = imageElement;
entity.width = img.naturalWidth;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment