diff --git a/src/app/_modules/publications/list/publications-list.component.ts b/src/app/_modules/publications/list/publications-list.component.ts
index 281df1d..1257b93 100644
--- a/src/app/_modules/publications/list/publications-list.component.ts
+++ b/src/app/_modules/publications/list/publications-list.component.ts
@@ -56,6 +56,7 @@ export class PublicationsListComponent {
fetch(controls: any) {
controls.filters.page = this.page.id;
let include = ['posters'];
+ console.log('controls.page',controls.page)
let params = {page: controls.page || 1, filters: JSON.stringify(controls.filters), include: include.join(',')};
this.publicationsService.list(params).subscribe(result => {
this.listsService.result(this.listId).next(result);
diff --git a/src/gbu/component/layout/grid/grid.component.html b/src/gbu/component/layout/grid/grid.component.html
index 63649b8..cf0099a 100644
--- a/src/gbu/component/layout/grid/grid.component.html
+++ b/src/gbu/component/layout/grid/grid.component.html
@@ -8,7 +8,18 @@
diff --git a/src/gbu/component/layout/grid/grid.component.ts b/src/gbu/component/layout/grid/grid.component.ts
index da3b7c4..a35cd85 100644
--- a/src/gbu/component/layout/grid/grid.component.ts
+++ b/src/gbu/component/layout/grid/grid.component.ts
@@ -2,6 +2,7 @@ import {Component} from '@angular/core';
import {Subscription} from "rxjs";
import {ListsService} from "@app/_services";
import { PagesService } from '@app/_services/pages.service';
+import {PublicationsService} from "@app/_services/publications.service";
@Component({
selector: 'grid',
@@ -15,14 +16,62 @@ export class GridComponent {
public bright: number = 150;
public contrast: number = 100;
+ public news:any;
+
subscription?: Subscription;
constructor(
- private listsService: ListsService, private pagesService: PagesService
+ private listsService: ListsService, private pagesService: PagesService, private publicationsService: PublicationsService
) {
}
ngOnInit() {
+ this.pagesService.currentPageSubject.subscribe(
+ currentPage=>{
+ if(currentPage && this.isRootPage){
+ console.log('currentPage',currentPage.link)
+ this.pagesService.find(currentPage.link,{include: 'children.children'}).subscribe(
+ resp=> {
+ let children = resp.data.children.data;
+
+ this.news = children.find(
+ (child:any) => {
+ if (!child.children) {
+ return false
+ } else {
+ return child.children.data.reduce(
+ (resp:boolean, page:any ) =>{
+ return resp && page.type.name == 'publications'
+ }, true
+ )
+ }
+ }
+ ).children.data
+
+ this.news.forEach(page => {
+ this.publicationsService.list({
+ page:1,
+ filters:JSON.stringify({
+ page: page.id
+ }),
+ include: 'posters'
+ }).subscribe(
+ resp=>{
+ page.publications = resp.data.slice(0,3).map(
+ publication => ({
+ name: publication.name,
+ img: publication.posters.data[0].links.thumb,
+ link: publication.link
+ })
+ );
+ }
+ )
+ });
+ }
+ )
+ }
+ }
+ )
this.subscription = this.listsService.result('class').subscribe(val => {
this.classActive = val;
});
@@ -36,4 +85,5 @@ export class GridComponent {
return this.pagesService.currentPage && this.pagesService.currentPage.parents && this.pagesService.currentPage.parents.data.length == 0
}
+
}
diff --git a/src/gbu/component/layout/header/header.component.html b/src/gbu/component/layout/header/header.component.html
index 1b15752..5816e4d 100644
--- a/src/gbu/component/layout/header/header.component.html
+++ b/src/gbu/component/layout/header/header.component.html
@@ -16,7 +16,8 @@