diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ac007c4..e3832fa 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -8,8 +8,8 @@ import { InterviewComponent } from './interview/interview.component'; const routes: Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full'}, { path: 'home', component: HomeComponent }, - { path: 'entrevista', component: InterviewComponent }, - { path: 'entrevista/:id', component: InterviewComponent }, + { path: 'entrevistas', component: InterviewComponent }, + { path: 'entrevistas/:id', component: InterviewComponent }, { path: ':id', component: PageComponent }, { path: ':parent/intro', redirectTo:':parent'}, { path: ':parent/:id', component: PageComponent}, diff --git a/src/app/dedalo.service.ts b/src/app/dedalo.service.ts index a4004d4..6b79f31 100644 --- a/src/app/dedalo.service.ts +++ b/src/app/dedalo.service.ts @@ -3,18 +3,25 @@ import { Http, Response, RequestOptions, Headers, URLSearchParams } from '@angul import { Observable } from 'rxjs'; import 'rxjs/add/operator/map'; import { InterviewItem } from './interview'; +import { Entrevistas, Entrevista, ImageDedalo, Informant, Audiovisual} from './entrevista' @Injectable() export class DedaloService { - apiUrl : string = "https://localhost:3000/interview" + apiUrl : string = "http://api.industriapaisaia.eus/interviews" + entrevistas : Entrevista[] constructor( private http: Http - ) { } + ) {} - getInterviews() : Observable { - return this.http.get(this.apiUrl); + getInterviews() : Observable { + return this.http.get(this.apiUrl) + .map( (res: Response)=> { + //console.log('response :') + console.log(res.json()) + return res.json() + }) } } diff --git a/src/app/entrevista.ts b/src/app/entrevista.ts new file mode 100644 index 0000000..9fb5680 --- /dev/null +++ b/src/app/entrevista.ts @@ -0,0 +1,42 @@ +export class Entrevistas { + constructor ( + public count: number, + public result: Entrevista[] + ) {} +} + +export class Entrevista { + constructor( + public id : string, + public lang? : string, + public title? : string, + public abstract? : string, + public date? : string, + public informant?: Informant[], + public image?: ImageDedalo[], + public audiovisual?: Audiovisual[], + ) {} +} + +export class Informant { + constructor( + public id: string, + public name: string, + public surname: string + ) {} +} + +export class ImageDedalo { + constructor( + public id: string, + public src: string + ){} +} + +export class Audiovisual { + constructor( + public id: string, + public video: string, + public rsc36: string + ){} +} diff --git a/src/app/interview-grid/interview-grid.component.html b/src/app/interview-grid/interview-grid.component.html index 799cc29..4098c60 100644 --- a/src/app/interview-grid/interview-grid.component.html +++ b/src/app/interview-grid/interview-grid.component.html @@ -1,11 +1,42 @@ -
-
-

Trabajo

- -
-

Breve intro de la entrevista aquĆ­ disponible.

-
+ +
+
+
+ +
+

{{entrevista.title}}

+

{{entrevista.date}}

+
{{entrevista.abstract}}
+ +
    +
  • {{i.surname}}, {{i.name}}
  • +
+ +
+ +
+
+
+
+
+
+
+ +
+

+
+
+
+
diff --git a/src/app/interview-grid/interview-grid.component.ts b/src/app/interview-grid/interview-grid.component.ts index dcb39be..267f996 100644 --- a/src/app/interview-grid/interview-grid.component.ts +++ b/src/app/interview-grid/interview-grid.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit, Input} from '@angular/core'; import { InterviewItem } from '../interview'; +import { Entrevista } from '../entrevista'; + @Component({ selector: 'app-interview-grid', @@ -8,11 +10,11 @@ import { InterviewItem } from '../interview'; }) export class InterviewGridComponent implements OnInit { - @Input() interviews : InterviewItem[] + @Input() entrevistas : Entrevista[] + @Input() single: boolean - constructor() { } + constructor() {} - ngOnInit() { - } + ngOnInit() {} } diff --git a/src/app/interview/interview.component.html b/src/app/interview/interview.component.html index e968e48..0545e51 100644 --- a/src/app/interview/interview.component.html +++ b/src/app/interview/interview.component.html @@ -14,7 +14,7 @@
- +
diff --git a/src/app/interview/interview.component.ts b/src/app/interview/interview.component.ts index 2504bb9..8c3559c 100644 --- a/src/app/interview/interview.component.ts +++ b/src/app/interview/interview.component.ts @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core'; import { PageItem } from '../page'; import { InterviewItem } from '../interview'; import { DedaloService } from '../dedalo.service'; +import { Entrevista } from '../entrevista'; +import { ActivatedRoute,Router, NavigationEnd } from "@angular/router"; @Component({ selector: 'app-interview', @@ -12,9 +14,13 @@ export class InterviewComponent implements OnInit { pages : PageItem[]; interviews : InterviewItem[]; + entrevistas : Entrevista[] + entrevistaID: string + single: boolean = false constructor( - private dedaloService : DedaloService + private entrevistaService : DedaloService, + private route: ActivatedRoute, ) { let p = new PageItem( '0', @@ -25,6 +31,11 @@ export class InterviewComponent implements OnInit { '0' ); this.pages = [p]; + this.getEntrevistas() + this.route.params.subscribe( params => { + this.entrevistaID = params.id + if (params.id) this.single = true + }); } ngOnInit() { @@ -34,4 +45,20 @@ export class InterviewComponent implements OnInit { this.interviews = []; } + getEntrevistas() { + this.entrevistaService.getInterviews() + .subscribe(data => { + // data.result.forEach( (e) => { + // e.audiovisal.forEach( (v) => { + // v.video = v.video.replace(/^.*[\\\/]/, '') + // }) + // }) + this.entrevistas = data.result + this.entrevistas = this.entrevistas.filter(entrevista => entrevista.lang == 'lg-spa') + if (this.entrevistaID) { + this.entrevistas = this.entrevistas.filter(entrevista => entrevista.id == this.entrevistaID) + } + }) + } + } diff --git a/src/app/page/page.component.ts b/src/app/page/page.component.ts index 5aebd9c..1f25c72 100644 --- a/src/app/page/page.component.ts +++ b/src/app/page/page.component.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { PageService } from '../page.service'; +import { DedaloService } from '../dedalo.service'; +import { Entrevista } from '../entrevista'; import { PageItem } from '../page'; import { ActivatedRoute,Router, NavigationEnd } from "@angular/router"; import { SafeResourceUrl, DomSanitizer,SafeUrl } from '@angular/platform-browser'; @@ -34,7 +36,8 @@ import * as $ from 'jquery'; }) export class PageComponent implements OnInit { - pages : PageItem[] = []; + pages : PageItem[] = [] + entrevistas : Entrevista[] slug : string; parent : string; imageIndex = 1; @@ -47,12 +50,14 @@ export class PageComponent implements OnInit { private pageService: PageService, private galleryService: GalleryService, private sanitizer: DomSanitizer, - private router: Router + private router: Router, + private entrevistaService : DedaloService ){ this.route.params.subscribe( params => { this.slug = params.id; - this.parent = params.parent; - this.getPage(); + this.parent = params.parent + this.getPage() + // this.getEntrevistas() } ); } @@ -68,6 +73,17 @@ export class PageComponent implements OnInit { }); } + get diagnosticEntrevistas() { + return JSON.stringify(this.entrevistas) + } + + // getEntrevistas() { + // this.entrevistaService.getInterviews() + // .subscribe(data => { + // this.entrevistas = data.result + // }) + // } + getPage() { // console.log(this.slug); this.pageService.getPage(this.slug)