Add Page selector for PDFs

This commit is contained in:
Siroco 2018-12-06 15:32:24 +01:00
parent ad311f82df
commit d1cd6bd6a6
4 changed files with 6 additions and 3 deletions

View File

@ -88,7 +88,10 @@ export class PageService {
page['parent_title']=item['parentTitle']['title']; page['parent_title']=item['parentTitle']['title'];
page['parent_link']=item['parentTitle']['link']; page['parent_link']=item['parentTitle']['link'];
if (item['acf']['pdf']) { page['pdf']=item['acf']['pdf']; } if (item['acf']['pdf']) {
page['pdf']=item['acf']['pdf'];
if (item['acf']['pagina_del_pdf']) page['pdf']['url'] = page['pdf']['url']+"#page="+item['acf']['pagina_del_pdf'];
}
else { page['pdf']=null; } else { page['pdf']=null; }
/* chilsd */ /* chilsd */

View File

@ -22,6 +22,7 @@ export class PageItem {
es:{ slug:string}, es:{ slug:string},
eu:{ slug:string}, eu:{ slug:string},
}, },
public pdf?:any,
) {} ) {}
// public set (key,attr) { // public set (key,attr) {

View File

@ -41,7 +41,6 @@
</section> </section>
<section class="section-publitas"> <section class="section-publitas">
<div class="row" *ngIf="page.pdf"> <div class="row" *ngIf="page.pdf">
<div class="col-md-12"> <div class="col-md-12">
<!-- <div><h3>{{page.pdf.title}}</h3></div> --> <!-- <div><h3>{{page.pdf.title}}</h3></div> -->
<simple-pdf-viewer #pdfViewer [src]="page.pdf.url" [removePageBorders]="true" (onProgress)="onProgressPDF($event,page.pdf.filesize)"></simple-pdf-viewer> <simple-pdf-viewer #pdfViewer [src]="page.pdf.url" [removePageBorders]="true" (onProgress)="onProgressPDF($event,page.pdf.filesize)"></simple-pdf-viewer>

View File

@ -90,7 +90,7 @@ export class PageComponent implements OnInit {
.subscribe(data => { .subscribe(data => {
this.pages = data; this.pages = data;
this.pages.forEach( (p) => { this.pages.forEach( (p) => {
this.pageService.currentPage = p; this.pageService.currentPage = p as PageItem;
var safeUrl:SafeUrl; var safeUrl:SafeUrl;
safeUrl = this.sanitizer.bypassSecurityTrustUrl('https://backend.industriapaisaia.eus/wp-content/uploads/2018/10/test.pdf'); safeUrl = this.sanitizer.bypassSecurityTrustUrl('https://backend.industriapaisaia.eus/wp-content/uploads/2018/10/test.pdf');
p['publitas_link_sanitize'] = safeUrl; p['publitas_link_sanitize'] = safeUrl;