From 06b609b7518ae5e3f6bd00cc4122d27adecd0057 Mon Sep 17 00:00:00 2001 From: Robert Horlings Date: Tue, 28 Jul 2015 12:20:24 +0200 Subject: [PATCH] FT-1553 Added details about subject, event and group to sample overview screen --- .../studycapturing/StudyController.groovy | 30 +++++++++++++++++++ grails-app/views/study/samples.gsp | 10 +++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/grails-app/controllers/dbnp/studycapturing/StudyController.groovy b/grails-app/controllers/dbnp/studycapturing/StudyController.groovy index f4d447fa..ffa26d24 100644 --- a/grails-app/controllers/dbnp/studycapturing/StudyController.groovy +++ b/grails-app/controllers/dbnp/studycapturing/StudyController.groovy @@ -117,6 +117,36 @@ class StudyController { render datatableData as JSON } + + /** + * Returns data for a templated datatable with samples. + * + * Due to the formatting of the data, this is a separate method + * @return + */ + def dataTableSamples() { + // As we add columns to the table, we should shift the sort column + def sortColumn = params.int( "iSortCol_0" ) + + if( sortColumn > 3 ) + params.iSortCol_0 = sortColumn - 3 + + def datatableData = getTemplatedDatatablesData({ sample -> + def defaultData = datatablesService.defaultEntityFormatter(sample) + + // Remove the IDs, as they are irrelevant for now + defaultData = defaultData.tail() + + // Add additional columns + defaultData.add(1, sample.parentSubject?.name ) + defaultData.add(2, sample.parentEvent?.event?.name ) + defaultData.add(3, sample.parentEvent?.eventGroup?.name ) + + defaultData + }) + render datatableData as JSON + } + /** * Returns data for a templated datatable. The type of entities is based on the template given. * @return diff --git a/grails-app/views/study/samples.gsp b/grails-app/views/study/samples.gsp index d392df71..bd79b8b7 100644 --- a/grails-app/views/study/samples.gsp +++ b/grails-app/views/study/samples.gsp @@ -24,11 +24,17 @@

Template: ${template.name}

- +
+ + + + - + + +
NameSubjectEventGroup ${field.name}${field.name}