Changeset 629 for trunk/grails-app/views
- Timestamp:
- Jun 28, 2010, 10:17:03 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/views/study/show.gsp
r578 r629 14 14 15 15 // Number of timelines that should be loaded 16 var numTimelines = ${studyList .size()};16 var numTimelines = ${studyList?.size()}; 17 17 18 18 // This method is called on the event body.onLoad … … 93 93 94 94 def orphans = study.getOrphanEvents(); 95 if( orphans .size() > 0 ) {95 if( orphans?.size() > 0 ) { 96 96 sortedEventGroups.add( new EventGroup( 97 97 id: -1, … … 138 138 // We can only show appr. 30 characters per line and as many lines as there are events 139 139 def charsPerLine = 30; 140 def numEvents = eventGroup.events .size();140 def numEvents = eventGroup.events?.size(); 141 141 def maxChars = numEvents * charsPerLine; 142 142 143 143 // If the subjects will fit, show them all 144 if( simpleSubjects .size() < maxChars ) {144 if( simpleSubjects?.size() < maxChars ) { 145 145 showSubjects = simpleSubjects; 146 146 } else { … … 152 152 sortedGroupSubjects.each { subject -> 153 153 if( id > 0 ) { 154 println( "ID: " + id + " - " + subjectNames .size() + " - " + subject.name.size() + " - " + maxChars );155 if( subjectNames .size() + subject.name.size() < maxChars - 15 ) {154 println( "ID: " + id + " - " + subjectNames?.size() + " - " + subject.name?.size() + " - " + maxChars ); 155 if( subjectNames?.size() + subject.name?.size() < maxChars - 15 ) { 156 156 subjectNames += ", " + subject.name; 157 157 } else { … … 163 163 164 164 // Add a postfix 165 subjectNames += " and " + ( sortedGroupSubjects .size() - id ) + " more";165 subjectNames += " and " + ( sortedGroupSubjects?.size() - id ) + " more"; 166 166 167 167 showSubjects = subjectNames; … … 227 227 // to show a proper list. We want every field to appear just once, 228 228 // so the list is filtered for unique values 229 studyFields = studyList[0].giveDomainFields() + studyList*.giveTemplateFields() .flatten().unique()229 studyFields = studyList[0].giveDomainFields() + studyList*.giveTemplateFields()?.flatten().unique() 230 230 %> 231 231 <!-- Show all template and domain fields, if filled --> … … 234 234 // If a value is not set for any of the selected studies, the 235 235 // field should not appear in the list 236 showField = true in studyList.collect { it.fieldExists( field.name ) && it.getFieldValue( field.name ) != null } .flatten()236 showField = true in studyList.collect { it.fieldExists( field.name ) && it.getFieldValue( field.name ) != null }?.flatten() 237 237 %> 238 238 <g:if test="${showField}"> … … 251 251 <g:each in="${studyList}" var="studyInstance"> 252 252 <td> 253 <g:if test="${studyInstance.giveEventTemplates() .size()==0}">253 <g:if test="${studyInstance.giveEventTemplates()?.size()==0}"> 254 254 - 255 255 </g:if> … … 264 264 <g:each in="${studyList}" var="studyInstance"> 265 265 <td> 266 <g:if test="${studyInstance.giveSamplingEventTemplates() .size()==0}">266 <g:if test="${studyInstance.giveSamplingEventTemplates()?.size()==0}"> 267 267 - 268 268 </g:if> … … 277 277 <g:each in="${studyList}" var="studyInstance"> 278 278 <td> 279 <g:if test="${studyInstance.readers .size()==0}">279 <g:if test="${studyInstance.readers?.size()==0}"> 280 280 - 281 281 </g:if> … … 293 293 <g:each in="${studyList}" var="studyInstance"> 294 294 <td> 295 <g:if test="${studyInstance.editors .size()==0}">295 <g:if test="${studyInstance.editors?.size()==0}"> 296 296 - 297 297 </g:if> … … 311 311 <div id="subjects"> 312 312 313 <g:if test="${studyList*.subjects .flatten().size()==0}">313 <g:if test="${studyList*.subjects?.flatten()?.size()==0}"> 314 314 No subjects in the selected studies 315 315 </g:if> … … 330 330 // We want every field to appear just once, 331 331 // so the list is filtered for unique values 332 subjectTemplates = studyList*.giveSubjectTemplates() .flatten().unique()332 subjectTemplates = studyList*.giveSubjectTemplates()?.flatten().unique() 333 333 if( !subjectTemplates ) { 334 334 subjectTemplates = []; 335 335 subjectFields = []; 336 336 } else { 337 subjectFields = subjectTemplates*.fields .flatten().unique()337 subjectFields = subjectTemplates*.fields?.flatten().unique() 338 338 if( !subjectFields ) { 339 339 subjectFields = []; … … 346 346 * 347 347 * // These took about 9 seconds (for 31 subjects and 348 * allSubjects = studyList*.subjects .flatten()348 * allSubjects = studyList*.subjects?.flatten() 349 349 * 350 350 * subjectFields = subjectFields.findAll { subjectField -> … … 354 354 355 355 // Filter out all fields that are left blank for all subjects 356 allSubjects = studyList*.subjects .flatten()356 allSubjects = studyList*.subjects?.flatten() 357 357 358 358 showSubjectFields = [] … … 390 390 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 391 391 <g:if test="${multipleStudies && j==0}"> 392 <td class="studytitle" rowspan="${sortedSubjects .size()}">392 <td class="studytitle" rowspan="${sortedSubjects?.size()}"> 393 393 ${studyInstance.title} 394 394 </td> … … 418 418 419 419 <div id="events-timeline"> 420 <g:if test="${studyList*.events .flatten().size()==0 && studyInstance*.samplingEvents.flatten().size()==0 }">420 <g:if test="${studyList*.events?.flatten()?.size()==0 && studyInstance*.samplingEvents?.flatten()?.size()==0 }"> 421 421 No events in these studies 422 422 </g:if> … … 459 459 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 460 460 <g:if test="${multipleStudies && j==0}"> 461 <td class="studytitle" rowspan="${sortedEvents .size()}">461 <td class="studytitle" rowspan="${sortedEvents?.size()}"> 462 462 ${studyInstance.title} 463 463 </td> … … 497 497 498 498 <div id="events-table"> 499 <g:if test="${studyList*.eventGroups .flatten().size()==0}">499 <g:if test="${studyList*.eventGroups?.flatten()?.size()==0}"> 500 500 No event groups in this study 501 501 </g:if> … … 506 506 // We want every field to appear just once, 507 507 // so the list is filtered for unique values 508 groupTemplates = studyList*.giveAllEventTemplates() .flatten().unique()508 groupTemplates = studyList*.giveAllEventTemplates()?.flatten().unique() 509 509 %> 510 510 <table> … … 515 515 </g:if> 516 516 <th>Name</th> 517 <th colspan="${groupTemplates .size()}">Events</th>517 <th colspan="${groupTemplates?.size()}">Events</th> 518 518 <th>Subjects</th> 519 519 </tr> … … 539 539 540 540 def orphans = studyInstance.getOrphanEvents(); 541 if( orphans .size() > 0 ) {541 if( orphans?.size() > 0 ) { 542 542 sortedEventGroups.add( new EventGroup( 543 543 id: -1, … … 552 552 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 553 553 <g:if test="${multipleStudies && j==0}"> 554 <td class="studytitle" rowspan="${sortedEventGroups .size()}">554 <td class="studytitle" rowspan="${sortedEventGroups?.size()}"> 555 555 ${studyInstance.title} 556 556 </td> … … 591 591 592 592 <div id="assays"> 593 <g:if test="${studyList*.assays .flatten().size()==0}">593 <g:if test="${studyList*.assays?.flatten()?.size()==0}"> 594 594 No assays in these studies 595 595 </g:if> … … 615 615 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 616 616 <g:if test="${multipleStudies && j==0}"> 617 <td class="studytitle" rowspan="${studyInstance.assays .size()}">617 <td class="studytitle" rowspan="${studyInstance.assays?.size()}"> 618 618 ${studyInstance.title} 619 619 </td> … … 639 639 <div id="samples"> 640 640 641 <g:if test="${studyList*.samples.flatten() .size()==0}">641 <g:if test="${studyList*.samples.flatten()?.size()==0}"> 642 642 No samples in the selected studies 643 643 </g:if> … … 709 709 <tr class="${(i % 2) == 0 ? 'odd' : 'even'}"> 710 710 <g:if test="${multipleStudies && j==0}"> 711 <td class="studytitle" rowspan="${sortedSamples .size()}">711 <td class="studytitle" rowspan="${sortedSamples?.size()}"> 712 712 ${studyInstance.title} 713 713 </td> … … 742 742 allPersons = studyList*.persons*.person.flatten().unique() 743 743 %> 744 <g:if test="${allPersons .size()==0}">744 <g:if test="${allPersons?.size()==0}"> 745 745 No persons involved in these studies 746 746 </g:if> … … 793 793 allPublications = studyList*.publications.flatten().unique() 794 794 %> 795 <g:if test="${allPublications .size()==0}">795 <g:if test="${allPublications?.size()==0}"> 796 796 No publications attached to these studies 797 797 </g:if> … … 838 838 <div class="buttons"> 839 839 <g:form> 840 <g:if test="${studyList .size() == 1}">840 <g:if test="${studyList?.size() == 1}"> 841 841 <g:set var="studyInstance" value="${studyList[0]}" /> 842 842 <g:hiddenField name="id" value="${studyInstance?.id}" />
Note: See TracChangeset
for help on using the changeset viewer.