mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Update metadataservice citation tag to refer to new download page
This commit is contained in:
@@ -6,6 +6,7 @@ import { getCommunityPageRoute } from './+community-page/community-page-routing-
|
|||||||
import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths';
|
import { getCollectionPageRoute } from './+collection-page/collection-page-routing-paths';
|
||||||
import { getItemPageRoute } from './+item-page/item-page-routing-paths';
|
import { getItemPageRoute } from './+item-page/item-page-routing-paths';
|
||||||
import { hasValue } from './shared/empty.util';
|
import { hasValue } from './shared/empty.util';
|
||||||
|
import { URLCombiner } from './core/url-combiner/url-combiner';
|
||||||
|
|
||||||
export const BITSTREAM_MODULE_PATH = 'bitstreams';
|
export const BITSTREAM_MODULE_PATH = 'bitstreams';
|
||||||
|
|
||||||
@@ -13,6 +14,10 @@ export function getBitstreamModuleRoute() {
|
|||||||
return `/${BITSTREAM_MODULE_PATH}`;
|
return `/${BITSTREAM_MODULE_PATH}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBitstreamDownloadRoute(bitstream) : string{
|
||||||
|
return new URLCombiner(getBitstreamModuleRoute(), bitstream.uuid, 'download').toString();
|
||||||
|
}
|
||||||
|
|
||||||
export const ADMIN_MODULE_PATH = 'admin';
|
export const ADMIN_MODULE_PATH = 'admin';
|
||||||
|
|
||||||
export function getAdminModuleRoute() {
|
export function getAdminModuleRoute() {
|
||||||
|
@@ -222,7 +222,7 @@ describe('MetadataService', () => {
|
|||||||
expect(tagStore.get('citation_dissertation_name')[0].content).toEqual('Test PowerPoint Document');
|
expect(tagStore.get('citation_dissertation_name')[0].content).toEqual('Test PowerPoint Document');
|
||||||
expect(tagStore.get('citation_dissertation_institution')[0].content).toEqual('Mock Publisher');
|
expect(tagStore.get('citation_dissertation_institution')[0].content).toEqual('Mock Publisher');
|
||||||
expect(tagStore.get('citation_abstract_html_url')[0].content).toEqual([environment.ui.baseUrl, router.url].join(''));
|
expect(tagStore.get('citation_abstract_html_url')[0].content).toEqual([environment.ui.baseUrl, router.url].join(''));
|
||||||
expect(tagStore.get('citation_pdf_url')[0].content).toEqual('https://dspace7.4science.it/dspace-spring-rest/api/core/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/content');
|
expect(tagStore.get('citation_pdf_url')[0].content).toEqual('/bitstreams/99b00f3c-1cc6-4689-8158-91965bee6b28/download');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('items page should set meta tags as published Technical Report', fakeAsync(() => {
|
it('items page should set meta tags as published Technical Report', fakeAsync(() => {
|
||||||
|
@@ -22,6 +22,8 @@ import { Item } from '../shared/item.model';
|
|||||||
import { getFirstSucceededRemoteDataPayload, getFirstSucceededRemoteListPayload } from '../shared/operators';
|
import { getFirstSucceededRemoteDataPayload, getFirstSucceededRemoteListPayload } from '../shared/operators';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { RootDataService } from '../data/root-data.service';
|
import { RootDataService } from '../data/root-data.service';
|
||||||
|
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||||
|
import { getBitstreamDownloadRoute, getBitstreamModuleRoute } from '../../app-routing-paths';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MetadataService {
|
export class MetadataService {
|
||||||
@@ -40,7 +42,6 @@ export class MetadataService {
|
|||||||
private dsoNameService: DSONameService,
|
private dsoNameService: DSONameService,
|
||||||
private bitstreamDataService: BitstreamDataService,
|
private bitstreamDataService: BitstreamDataService,
|
||||||
private bitstreamFormatDataService: BitstreamFormatDataService,
|
private bitstreamFormatDataService: BitstreamFormatDataService,
|
||||||
private redirectService: HardRedirectService,
|
|
||||||
private rootService: RootDataService
|
private rootService: RootDataService
|
||||||
) {
|
) {
|
||||||
// TODO: determine what open graph meta tags are needed and whether
|
// TODO: determine what open graph meta tags are needed and whether
|
||||||
@@ -286,7 +287,8 @@ export class MetadataService {
|
|||||||
getFirstSucceededRemoteDataPayload()
|
getFirstSucceededRemoteDataPayload()
|
||||||
).subscribe((format: BitstreamFormat) => {
|
).subscribe((format: BitstreamFormat) => {
|
||||||
if (format.mimetype === 'application/pdf') {
|
if (format.mimetype === 'application/pdf') {
|
||||||
this.addMetaTag('citation_pdf_url', bitstream._links.content.href);
|
const bitstreamLink = getBitstreamDownloadRoute(bitstream);
|
||||||
|
this.addMetaTag('citation_pdf_url', bitstreamLink);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,6 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { FileService } from '../../core/shared/file.service';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
|
||||||
import { Bitstream } from '../../core/shared/bitstream.model';
|
import { Bitstream } from '../../core/shared/bitstream.model';
|
||||||
import { getBitstreamModuleRoute } from '../../app-routing-paths';
|
import { getBitstreamDownloadRoute } from '../../app-routing-paths';
|
||||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-file-download-link',
|
selector: 'ds-file-download-link',
|
||||||
@@ -24,22 +20,11 @@ export class FileDownloadLinkComponent implements OnInit {
|
|||||||
@Input() bitstream: Bitstream;
|
@Input() bitstream: Bitstream;
|
||||||
bitstreamPath: string;
|
bitstreamPath: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not the current user is authenticated
|
|
||||||
*/
|
|
||||||
isAuthenticated$: Observable<boolean>;
|
|
||||||
|
|
||||||
constructor(private fileService: FileService,
|
|
||||||
private authService: AuthService,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.isAuthenticated$ = this.authService.isAuthenticated();
|
|
||||||
this.bitstreamPath = this.getBitstreamPath();
|
this.bitstreamPath = this.getBitstreamPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
getBitstreamPath() {
|
getBitstreamPath() {
|
||||||
return new URLCombiner(getBitstreamModuleRoute(), this.bitstream.uuid, 'download').toString();
|
return getBitstreamDownloadRoute(this.bitstream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user