From 8287f4d43a288f427b862e3ac44eadf797ac874b Mon Sep 17 00:00:00 2001 From: annampak Date: Mon, 6 Nov 2017 11:57:13 +0200 Subject: [PATCH] Toc --- dmp-frontend/src/app/entities/model/section.ts | 1 + dmp-frontend/src/app/form/dynamic-form.component.html | 11 +++++++---- dmp-frontend/src/app/form/dynamic-form.component.ts | 9 +++++---- .../src/app/form/tableOfContents/toc.component.html | 4 ++-- .../src/app/form/tableOfContents/toc.component.ts | 7 ++++--- .../src/app/services/dataModelBuilder.service.ts | 1 + 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/dmp-frontend/src/app/entities/model/section.ts b/dmp-frontend/src/app/entities/model/section.ts index 76ed51722..fe540dd8c 100644 --- a/dmp-frontend/src/app/entities/model/section.ts +++ b/dmp-frontend/src/app/entities/model/section.ts @@ -9,4 +9,5 @@ export class Section { defaultVisibility: boolean; ordinal: number; groupFields: GroupBase[]; + page:number; } \ No newline at end of file diff --git a/dmp-frontend/src/app/form/dynamic-form.component.html b/dmp-frontend/src/app/form/dynamic-form.component.html index e3a5665a6..eaacc15b0 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.html +++ b/dmp-frontend/src/app/form/dynamic-form.component.html @@ -2,12 +2,15 @@
-
-
-

{{section.title}}

+
+
+

{{section.title}}

+
+
+

{{section.title}}

@@ -45,7 +48,7 @@
- +
diff --git a/dmp-frontend/src/app/form/dynamic-form.component.ts b/dmp-frontend/src/app/form/dynamic-form.component.ts index 910d88a0c..c78b31b1c 100644 --- a/dmp-frontend/src/app/form/dynamic-form.component.ts +++ b/dmp-frontend/src/app/form/dynamic-form.component.ts @@ -248,11 +248,12 @@ export class DynamicFormComponent implements OnInit { this.payLoad = JSON.stringify(this.form.value); } - shouldIShow(groupFields) { - debugger; - if (this.pagination.currentPage == groupFields[0].page){ + shouldIShow(element) { //pagination , pages are declared in xml for every groupfield + + if (this.pagination.currentPage == element.page){ return true; } + else return false; @@ -277,7 +278,7 @@ export class DynamicFormComponent implements OnInit { if (page < 1 || page > this.pagination.totalPages) { return; } - var pagesize = 3; + var pagesize = 4; // get pagination object from service this.pagination = this.pagerService.getPagination(this.dataModel.groups, this.dataModel.groups.length, page, pagesize); diff --git a/dmp-frontend/src/app/form/tableOfContents/toc.component.html b/dmp-frontend/src/app/form/tableOfContents/toc.component.html index e0793696d..aaade3bd5 100644 --- a/dmp-frontend/src/app/form/tableOfContents/toc.component.html +++ b/dmp-frontend/src/app/form/tableOfContents/toc.component.html @@ -7,8 +7,8 @@
  • {{group.title}}
  • diff --git a/dmp-frontend/src/app/form/tableOfContents/toc.component.ts b/dmp-frontend/src/app/form/tableOfContents/toc.component.ts index 9a6035e82..a9a8290c3 100644 --- a/dmp-frontend/src/app/form/tableOfContents/toc.component.ts +++ b/dmp-frontend/src/app/form/tableOfContents/toc.component.ts @@ -16,7 +16,7 @@ export class TocComponent implements OnInit{ private headers = new Array(); @Output() - setPage:EventEmitter = new EventEmitter(); + setPage:EventEmitter = new EventEmitter(); ngOnInit(){ var len = this.dataModel.groups.length; // I don't use headers , I use datamodel.groupfields @@ -26,9 +26,10 @@ export class TocComponent implements OnInit{ } - scrollToElemID(elemID, page){ + scrollToElemID(elemID, _page){ console.log("going to id:"+elemID) - // this.setPage.emit(2); + var page = parseInt(_page) + this.setPage.emit(page); scroll("#"+elemID); } diff --git a/dmp-frontend/src/app/services/dataModelBuilder.service.ts b/dmp-frontend/src/app/services/dataModelBuilder.service.ts index 88f99e43e..8424c32d5 100644 --- a/dmp-frontend/src/app/services/dataModelBuilder.service.ts +++ b/dmp-frontend/src/app/services/dataModelBuilder.service.ts @@ -363,6 +363,7 @@ export class dataModelBuilder { newSection.id = section._id; newSection.title = section.title; newSection.ordinal = section._ordinal; + newSection.page = section._page; newSection.groupFields = new Array(); fieldGroups.forEach(fldgroup => { if (fldgroup.section == newSection.id)