Changeset 862


Ignore:
Timestamp:
Aug 30, 2010, 4:16:31 PM (13 years ago)
Author:
duh
Message:
  • adding assay grouping page
Location:
trunk/grails-app
Files:
4 edited

Legend:

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

    r857 r862  
    669669                                }
    670670                        }.to "assays"
     671                        on("deleteAssay") {
     672                                // handle form data
     673                                assayPage(flow, flash, params)
     674
     675                                // reset errors
     676                                flash.errors = [:]
     677
     678                                // find this assay
     679                                def assay = flow.study.assays.find { it.getIdentifier() == (params.get('do') as int) }
     680
     681                                // perform delete
     682                                if (assay) flow.study.deleteAssay( assay )
     683                        }.to "assays"
    671684                        on("previous") {
    672685                                // handle form data
     
    682695                                assayPage(flow, flash, params) ? success() : error()
    683696                        }.to "assayGroups"
     697                        on("quickSave") {
     698                                // handle form data
     699                                assayPage(flow, flash, params) ? success() : error()
     700                        }.to "waitForSave"
    684701                }
    685702
     
    703720                                assayGroupPage(flow, flash, params) ? success() : error()
    704721                        }.to "confirm"
     722                        on("quickSave") {
     723                                // handle form data
     724                                assayGroupPage(flow, flash, params) ? success() : error()
     725                        }.to "waitForSave"
    705726                }
    706727
     
    13031324                flash.values = params
    13041325
     1326                // iterate through samples
     1327                flow.study.samples.each() { sample ->
     1328                        // iterate through assays
     1329                        flow.study.assays.each() { assay ->
     1330                                if (params.get( 'sample_' + sample.getIdentifier() + '_assay_' + assay.getIdentifier() )) {
     1331                                        println "add sample "+sample.getIdentifier()+" to assay "+assay.getIdentifier()
     1332                                        // add sample to assay
     1333                                        assay.addToSamples( sample )
     1334                                } else {
     1335                                        // remove sample from assay
     1336                                        assay.removeFromSamples( sample )
     1337                                }
     1338                                println assay.samples
     1339                        }
     1340                }
     1341
    13051342                return !errors
    13061343        }
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r861 r862  
    4444        static constraints = {
    4545                owner(nullable: true, blank: true)
    46                 code(nullable:false, blank:true,unique:true) 
     46                code(nullable:false, blank:true,unique:true)
    4747        }
    4848
     
    8282         */
    8383        def String toString() {
    84                 return code + " - " + title
     84                return title
    8585        }
    8686
     
    219219
    220220                return msg
     221        }
     222
     223        /**
     224         * Delete an assay from the study
     225         * @param Assay
     226         * @void
     227         */
     228        def deleteAssay(Assay assay) {
     229                // remove this assay from the study
     230                this.removeFromAssays( assay )
    221231        }
    222232
  • trunk/grails-app/views/wizard/pages/_assay_groups.gsp

    r836 r862  
    2222        </span>
    2323
    24         <%
    25             // TODO: render a table of assays (in the columns) versus samples (in the rows)
    26                 // with the samples grouped according to the EventGroups of the parent SamplingEvents
    27                 // and with all boxes checked by default
    28         %>
     24        <g:if test="${(study.samples && study.assays)}">
     25                <g:set var="previousTemplate" value=""/>
     26                <div class="table">
     27                <div class="header">
     28                        <div class="firstColumn">#</div>
     29                        <div class="column" style="width:150px;">Sample Type</div>
     30                        <div class="column" style="width:200px;">Sample Name</div>
     31                        <g:each var="assay" in="${study.assays}">
     32                        <div class="column">${assay}</div>
     33                        </g:each>
     34                </div>
     35                <g:each var="sampleTemplate" in="${study.giveSampleTemplates()}">
     36                        <g:each var="sample" in="${study.giveSamplesForTemplate(sampleTemplate)}">
     37                                <div class="row">
     38                                        <div class="firstColumn">${sample.getIdentifier()}</div>
     39                                        <div class="column">
     40                                                <g:if test="${previousTemplate != sampleTemplate.name}">
     41                                                        <g:set var="previousTemplate" value="${sampleTemplate.name}"/>
     42                                                        ${sampleTemplate.name}
     43                                                        <div class="helpIcon"></div>
     44                                                        <div class="helpContent">
     45                                                                <h1>${sampleTemplate.name}</h1>
     46                                                                <h2>Template Fields:</h2>
     47                                                                <g:each var="field" in="${sample.giveFields()}">
     48                                                                        ${field.name[0].toUpperCase() + field.name.substring(1)}<br/>
     49                                                                </g:each>
     50                                                        </div>
     51                                                </g:if>
     52                                        </div>
     53                                        <div class="column">${sample.name}</div>
     54                                        <g:each var="assay" in="${study.assays}">
     55                                        <div class="column">
     56                                                <input type="checkbox" name="sample_${sample.getIdentifier()}_assay_${assay.getIdentifier()}"<g:if test="${assay.samples.find{ it == sample } }"> checked="checked"</g:if>/>
     57                                        </div>
     58                                        </g:each>
     59                                </div>
     60                        </g:each>
     61                </g:each>
     62                </div>
     63                <div class="sliderContainer">
     64                        <div class="slider" ></div>
     65                </div>
     66        </g:if>
    2967
    3068</wizard:pageContent>
  • trunk/grails-app/views/wizard/pages/_groups.gsp

    r857 r862  
    6464                                <g:if test="${study.eventGroups}"><g:each var="eventGroup" in="${study.eventGroups}">
    6565                                <div class="column">
    66                                         <g:if test="${eventGroup.subjects.find{ it == subject } }">
    67                                                 <input type="checkbox" name="subject_${subject.getIdentifier()}_group_${eventGroup.getIdentifier()}" checked="checked"/>
    68                                         </g:if><g:else>
    69                                                 <input type="checkbox" name="subject_${subject.getIdentifier()}_group_${eventGroup.getIdentifier()}" />
    70                                         </g:else>
     66                                        <input type="checkbox" name="subject_${subject.getIdentifier()}_group_${eventGroup.getIdentifier()}"<g:if test="${eventGroup.subjects.find{ it == subject } }"> checked="checked"</g:if>/>
    7167                                </div>
    7268                                </g:each></g:if>
Note: See TracChangeset for help on using the changeset viewer.