...
 
Commits (2)
......@@ -58,17 +58,19 @@ export class ProTileComponent {
}
tileClicked() {
switch(this.getType(this.entity)) {
switch (this.getType(this.entity)) {
case 'object:image':
case 'object:video':
this.showMediaModal();
break;
case 'object:blog':
this.channelService.open(this.entity, this.modalService);
break;
}
}
showMediaModal() {
const activity = toMockActivity(this.entity);
const activity = toMockActivity(this.entity, this.entity.subtype === 'video' ? this.videoDimensions : null);
if (this.featuresService.has('media-modal')) {
// Mobile (not tablet) users go to media page instead of modal
// if (isMobile() && Math.min(screen.width, screen.height) < 768) {
......@@ -77,7 +79,7 @@ export class ProTileComponent {
if (activity.custom_type === 'video') {
activity.custom_data.dimensions = this.videoDimensions;
} else { // Image
} else if (activity.custom_type === 'image') { // Image
// Set image dimensions if they're not already there
const img: HTMLImageElement = this.img.nativeElement;
activity.custom_data[0].width = img.naturalWidth;
......
......@@ -2,7 +2,7 @@
* generates an activity from an image or video
* @param entity
*/
export default function toMockActivity(entity: any) {
export default function toMockActivity(entity: any, dimensions?: any) {
let obj = {
...entity,
entity_guid: entity.guid,
......@@ -12,8 +12,16 @@ export default function toMockActivity(entity: any) {
if (entity.subtype === 'video') {
obj.custom_data = {
...entity,
dimensions: this.videoDimensions
dimensions: dimensions
};
} else if (entity.subtype === 'blog') {
obj.custom_data = [{
...entity,
dimensions: {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
}];
} else {
obj.custom_data = [{
...entity,
......@@ -24,3 +32,16 @@ export default function toMockActivity(entity: any) {
return obj;
}
class Translate {
execute(entity: any) {
}
}
class ImageTranslate extends Translate {
execute(entity: any) {
return {};
}
}