Changeset 1583


Ignore:
Timestamp:
Mar 2, 2011, 5:40:25 PM (6 years ago)
Author:
s.h.sikkema@…
Message:

UI improvements to assay exporter (ticket #159)

Location:
trunk/grails-app
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy

    r1576 r1583  
    150150            flash.errorMessage = e.message
    151151            redirect action: 'selectAssay'
    152                         return;
     152                        return
    153153
    154154        }
     
    159159        flash.assayId = params.assayId
    160160
    161         [fieldMap: fieldMap, measurementTokens: measurementTokens*.name]
     161        [fieldMap: fieldMap, measurementTokens: measurementTokens.name]
    162162    }
    163163
     
    170170
    171171        def fieldMap = flash.fieldMap
    172         def measurementTokens = flash.measurementTokens
    173172
    174173        def fieldMapSelection = [:]
     
    199198        if (params."cat_4" == 'on') {
    200199
    201             measurementTokensSelection = params.measurementToken == 'null' ? measurementTokens : [ name: params.measurementToken]
     200            def measurementToken = params.measurementToken
     201
     202            if (measurementToken) {
     203
     204                if (measurementToken instanceof String)
     205                    measurementTokensSelection = [[name: measurementToken]]
     206                else
     207                    measurementTokensSelection = measurementToken.collect{[name: it]}
     208
     209            } else {
     210                measurementTokensSelection = flash.measurementTokens
     211            }
    202212
    203213        }
  • trunk/grails-app/services/dbnp/studycapturing/AssayService.groovy

    r1581 r1583  
    3333    def collectAssayTemplateFields(assay) throws Exception {
    3434
    35         def getUsedTemplateFieldNames = { templateEntities ->
     35        def getUsedTemplateFields = { templateEntities ->
    3636
    3737            // gather all unique and non null template fields that haves values
     
    4040                field && templateEntities.any { it.fieldExists(field.name) && it.getFieldValue(field.name) }
    4141
    42             }*.name
     42            }.collect{[name: it.name, comment: it.comment]}
    4343
    4444        }
     
    5353        def samples = assay.samples
    5454
    55         [   'Subject Data' :            getUsedTemplateFieldNames( samples*."parentSubject".unique() ),
    56             'Sampling Event Data' :     getUsedTemplateFieldNames( samples*."parentEvent".unique() ),
    57             'Sample Data' :             getUsedTemplateFieldNames( samples ),
    58             'Event Group' :             ['name'],
     55        [   'Subject Data' :            getUsedTemplateFields( samples*."parentSubject".unique() ),
     56            'Sampling Event Data' :     getUsedTemplateFields( samples*."parentEvent".unique() ),
     57            'Sample Data' :             getUsedTemplateFields( samples ),
     58            'Event Group' :             [[name: 'name', comment: 'Name of Event Group']],
    5959            'Module Measurement Data':  requestModuleMeasurementNames(assay)
    6060        ]
     
    172172        }
    173173
    174         [   'Subject Data' :            getFieldValues(samples, fieldMap['Subject Data'], 'parentSubject'),
    175             'Sampling Event Data' :     getFieldValues(samples, fieldMap['Sampling Event Data'], 'parentEvent'),
    176             'Sample Data' :             getFieldValues(samples, fieldMap['Sample Data']),
     174        [   'Subject Data' :            getFieldValues(samples, fieldMap['Subject Data']*.name, 'parentSubject'),
     175            'Sampling Event Data' :     getFieldValues(samples, fieldMap['Sampling Event Data']*.name, 'parentEvent'),
     176            'Sample Data' :             getFieldValues(samples, fieldMap['Sample Data']*.name),
    177177            'Event Group' :             eventFieldMap,
    178             'Module Measurement Data':  measurementTokens ? requestModuleMeasurements(assay, measurementTokens) : [:]
     178            'Module Measurement Data':  measurementTokens*.name ? requestModuleMeasurements(assay, measurementTokens) : [:]
    179179        ]
    180180    }
  • trunk/grails-app/views/assay/compileExportData.gsp

    r1581 r1583  
    1313  </head>
    1414  <body>
     15
     16  <h1>Below you see a preview of the resulting Excel file, click OK to generate it</h1>
    1517
    1618  <table>
  • trunk/grails-app/views/assay/selectAssay.gsp

    r1559 r1583  
    3333    ${flash.errorMessage}
    3434  </div>
    35   %{--<g:form name="assaySelect" action="exportAssayAsExcel">--}%
     35
     36  <h1>Select the assay you want to export data from</h1>
     37
    3638  <g:form name="assaySelect" action="selectFields">
    3739    <g:select optionKey="id" optionValue="title" name="studyId" from="${userStudies}" id="study"
  • trunk/grails-app/views/assay/selectFields.gsp

    r1581 r1583  
    1111  <meta name="layout" content="main" />
    1212  <title>Select assay fields</title>
     13  <script type="text/javascript" src="${resource(dir: 'js', file: 'tooltips.js', plugin: 'gdt')}"></script>
     14  <script type="text/javascript" src="${resource(dir: 'js', file: 'jquery.qtip-1.0.0-rc3.min.js', plugin: 'gdt')}"></script>
     15  <link rel="stylesheet" href="${resource(dir: 'css', file: 'templates.css')}"/>
    1316
    1417  <style type="text/css">
    15 
    16     .selectCategoryDiv{
    17       float: left;
    18       width: auto;
     18    .category{
     19      margin-left: 5px;
    1920    }
    2021
    21     .selectFieldDiv{
     22    .field{
     23      margin-left: 20px;
    2224    }
    2325
    24     .clear {clear: both;}
     26    .element .helpIcon{
     27      margin-top: 0;
     28    }
     29  </style>
    2530
    26   </style>
     31  <script type="text/javascript">
     32    $(document).ready(function() {
     33      attachHelpTooltips();
     34    })
     35  </script>
    2736</head>
    2837  <body>
    2938  <div>
     39
     40    <h1>Select the columns that you want to be included in the resulting Excel file</h1>
     41
    3042    <g:form name="fieldSelectForm" action="compileExportData">
    31       <div class="selectCategoryDiv">
    3243
    33         <g:set var="catNum" value="${0}"/>
     44      <g:set var="catNum" value="${0}"/>
     45      <g:each in="${fieldMap}" var="entry">
    3446
    35         <g:each in="${fieldMap + ['Measurement tokens':'']}">
     47          <assayExporter:categorySelector category="${entry.key}" ref="cat_${catNum}"/>
    3648
    37           <assay:categorySelector category="${it.key}" ref="cat_${catNum}"/><br/>
     49          <assayExporter:fieldSelectors ref="cat_${catNum}" fields="${entry.value}"/>
     50
    3851          <g:set var="catNum" value="${catNum + 1}"/>
    3952
    40         </g:each>
     53      </g:each>
    4154
    42       </div>
    43 
    44       <div class="selectFieldDiv">
    45 
    46         <g:set var="catNum" value="${0}"/>
    47 
    48         <g:each in="${fieldMap}">
    49 
    50           <assay:fieldSelector ref="cat_${catNum}" fieldNames="${it.value}"/><br/>
    51           <g:set var="catNum" value="${catNum + 1}"/>
    52 
    53         </g:each>
    54 
    55         <g:select name="measurementToken" id="measurementToken" from="${measurementTokens}" noSelection="${[null:'All tokens']}"/>
    56 
    57       </div>
    58 
    59       <div class="clear"></div>
    60 
     55      <assayExporter:categorySelector category="Measurements" ref="cat_${catNum}"/>
     56      <g:select name="measurementToken" id="measurementToken" from="${measurementTokens}" class="field" multiple="true"/>
     57      <br /><br />
    6158      <g:submitButton name="submit" value="Submit"/>
    6259
    6360    </g:form>
     61
    6462  </div>
    6563  </body>
Note: See TracChangeset for help on using the changeset viewer.