mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
Themed MediaViewerImageComponent
This commit is contained in:
@@ -30,6 +30,7 @@ import { MediaViewerComponent } from './media-viewer/media-viewer.component';
|
|||||||
import { ThemedMediaViewerComponent } from './media-viewer/themed-media-viewer.component';
|
import { ThemedMediaViewerComponent } from './media-viewer/themed-media-viewer.component';
|
||||||
import { MediaViewerVideoComponent } from './media-viewer/media-viewer-video/media-viewer-video.component';
|
import { MediaViewerVideoComponent } from './media-viewer/media-viewer-video/media-viewer-video.component';
|
||||||
import { MediaViewerImageComponent } from './media-viewer/media-viewer-image/media-viewer-image.component';
|
import { MediaViewerImageComponent } from './media-viewer/media-viewer-image/media-viewer-image.component';
|
||||||
|
import { ThemedMediaViewerImageComponent } from './media-viewer/media-viewer-image/themed-media-viewer-image.component';
|
||||||
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
||||||
import { MiradorViewerComponent } from './mirador-viewer/mirador-viewer.component';
|
import { MiradorViewerComponent } from './mirador-viewer/mirador-viewer.component';
|
||||||
import { VersionPageComponent } from './version-page/version-page/version-page.component';
|
import { VersionPageComponent } from './version-page/version-page/version-page.component';
|
||||||
@@ -66,6 +67,7 @@ const DECLARATIONS = [
|
|||||||
ThemedMediaViewerComponent,
|
ThemedMediaViewerComponent,
|
||||||
MediaViewerVideoComponent,
|
MediaViewerVideoComponent,
|
||||||
MediaViewerImageComponent,
|
MediaViewerImageComponent,
|
||||||
|
ThemedMediaViewerImageComponent,
|
||||||
MiradorViewerComponent,
|
MiradorViewerComponent,
|
||||||
VersionPageComponent,
|
VersionPageComponent,
|
||||||
];
|
];
|
||||||
|
@@ -18,7 +18,7 @@ export class MediaViewerImageComponent implements OnInit {
|
|||||||
@Input() preview?: boolean;
|
@Input() preview?: boolean;
|
||||||
@Input() image?: string;
|
@Input() image?: string;
|
||||||
|
|
||||||
loggedin: boolean;
|
thumbnailPlaceholder = './assets/images/replacement_image.svg';
|
||||||
|
|
||||||
galleryOptions: NgxGalleryOptions[];
|
galleryOptions: NgxGalleryOptions[];
|
||||||
galleryImages: NgxGalleryImage[];
|
galleryImages: NgxGalleryImage[];
|
||||||
@@ -28,7 +28,10 @@ export class MediaViewerImageComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
isAuthenticated$: Observable<boolean>;
|
isAuthenticated$: Observable<boolean>;
|
||||||
|
|
||||||
constructor(private authService: AuthService) {}
|
constructor(
|
||||||
|
protected authService: AuthService,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thi method sets up the gallery settings and data
|
* Thi method sets up the gallery settings and data
|
||||||
@@ -69,20 +72,20 @@ export class MediaViewerImageComponent implements OnInit {
|
|||||||
* @param medias input NgxGalleryImage array
|
* @param medias input NgxGalleryImage array
|
||||||
*/
|
*/
|
||||||
convertToGalleryImage(medias: MediaViewerItem[]): NgxGalleryImage[] {
|
convertToGalleryImage(medias: MediaViewerItem[]): NgxGalleryImage[] {
|
||||||
const mappadImages = [];
|
const mappedImages = [];
|
||||||
for (const image of medias) {
|
for (const image of medias) {
|
||||||
if (image.format === 'image') {
|
if (image.format === 'image') {
|
||||||
mappadImages.push({
|
mappedImages.push({
|
||||||
small: image.thumbnail
|
small: image.thumbnail
|
||||||
? image.thumbnail
|
? image.thumbnail
|
||||||
: './assets/images/replacement_image.svg',
|
: this.thumbnailPlaceholder,
|
||||||
medium: image.thumbnail
|
medium: image.thumbnail
|
||||||
? image.thumbnail
|
? image.thumbnail
|
||||||
: './assets/images/replacement_image.svg',
|
: this.thumbnailPlaceholder,
|
||||||
big: image.bitstream._links.content.href,
|
big: image.bitstream._links.content.href,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mappadImages;
|
return mappedImages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { ThemedComponent } from '../../../shared/theme-support/themed.component';
|
||||||
|
import { MediaViewerImageComponent } from './media-viewer-image.component';
|
||||||
|
import { MediaViewerItem } from '../../../core/shared/media-viewer-item.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Themed wrapper for {@link MediaViewerImageComponent}.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-themed-media-viewer-image',
|
||||||
|
styleUrls: [],
|
||||||
|
templateUrl: '../../../shared/theme-support/themed.component.html',
|
||||||
|
})
|
||||||
|
export class ThemedMediaViewerImageComponent extends ThemedComponent<MediaViewerImageComponent> {
|
||||||
|
|
||||||
|
@Input() images: MediaViewerItem[];
|
||||||
|
@Input() preview?: boolean;
|
||||||
|
@Input() image?: string;
|
||||||
|
|
||||||
|
protected inAndOutputNames: (keyof MediaViewerImageComponent & keyof this)[] = [
|
||||||
|
'images',
|
||||||
|
'preview',
|
||||||
|
'image',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected getComponentName(): string {
|
||||||
|
return 'MediaViewerImageComponent';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importThemedComponent(themeName: string): Promise<any> {
|
||||||
|
return import(`../../../../themes/${themeName}/app/item-page/media-viewer/media-viewer-image/media-viewer-image.component`);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected importUnthemedComponent(): Promise<any> {
|
||||||
|
return import('./media-viewer-image.component');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -16,7 +16,7 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="mediaList[0]?.format === 'image'">
|
<ng-container *ngIf="mediaList[0]?.format === 'image'">
|
||||||
<ds-media-viewer-image [images]="mediaList"></ds-media-viewer-image>
|
<ds-themed-media-viewer-image [images]="mediaList"></ds-themed-media-viewer-image>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container
|
<ng-container
|
||||||
@@ -27,10 +27,10 @@
|
|||||||
mediaList.length === 0
|
mediaList.length === 0
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<ds-media-viewer-image
|
<ds-themed-media-viewer-image
|
||||||
[image]="mediaList[0]?.thumbnail || thumbnailPlaceholder"
|
[image]="mediaList[0]?.thumbnail || thumbnailPlaceholder"
|
||||||
[preview]="false"
|
[preview]="false"
|
||||||
></ds-media-viewer-image>
|
></ds-themed-media-viewer-image>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {
|
||||||
|
MediaViewerImageComponent as BaseComponent
|
||||||
|
} from '../../../../../../app/item-page/media-viewer/media-viewer-image/media-viewer-image.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-media-viewer-image',
|
||||||
|
// templateUrl: './media-viewer-image.component.html',
|
||||||
|
templateUrl: '../../../../../../app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.html',
|
||||||
|
// styleUrls: ['./media-viewer-image.component.scss'],
|
||||||
|
styleUrls: ['../../../../../../app/item-page/media-viewer/media-viewer-image/media-viewer-image.component.scss'],
|
||||||
|
})
|
||||||
|
export class MediaViewerImageComponent extends BaseComponent {
|
||||||
|
}
|
@@ -85,6 +85,9 @@ import { ResourcePoliciesModule } from '../../app/shared/resource-policies/resou
|
|||||||
import { ComcolModule } from '../../app/shared/comcol/comcol.module';
|
import { ComcolModule } from '../../app/shared/comcol/comcol.module';
|
||||||
import { FeedbackComponent } from './app/info/feedback/feedback.component';
|
import { FeedbackComponent } from './app/info/feedback/feedback.component';
|
||||||
import { MediaViewerComponent } from './app/item-page/media-viewer/media-viewer.component';
|
import { MediaViewerComponent } from './app/item-page/media-viewer/media-viewer.component';
|
||||||
|
import {
|
||||||
|
MediaViewerImageComponent
|
||||||
|
} from './app/item-page/media-viewer/media-viewer-image/media-viewer-image.component';
|
||||||
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
import { NgxGalleryModule } from '@kolkov/ngx-gallery';
|
||||||
|
|
||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
@@ -130,6 +133,7 @@ const DECLARATIONS = [
|
|||||||
BreadcrumbsComponent,
|
BreadcrumbsComponent,
|
||||||
FeedbackComponent,
|
FeedbackComponent,
|
||||||
MediaViewerComponent,
|
MediaViewerComponent,
|
||||||
|
MediaViewerImageComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
Reference in New Issue
Block a user