Changeset 804

Show
Ignore:
Timestamp:
12-08-10 13:21:38 (4 years ago)
Author:
duh
Message:

- event template feedback was wrong
- made a generic change that both template fields as well as template headers:

  • split combined words in the view (e.g. MyCoolFieldName? --> My Cool Field Name)
  • capitalize seperate words in the view (e.g. My field name --> My Field Name)
Location:
trunk/grails-app
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy

    r803 r804  
    237237 
    238238                // render a form element 
    239                 if (attrs.get('elementId')) { 
    240                 out << '<div class="element" id="'+ attrs.remove('elementId') +'">' 
    241                 } else { 
    242                         out << '<div class="element">' 
    243                 } 
     239                out << '<div class="element"'+ ((attrs.get('elementId')) ? 'id="'+attrs.remove('elementId')+'"': '') + '>' 
    244240                out << ' <div class="description">' 
    245                 out << description 
     241                out << ((description) ? description.replaceAll(/[a-z][A-Z][a-z]/) { it[0] + ' ' + it[1..2] }.replaceAll(/\w+/) { it[0].toUpperCase() + ((it.size() > 1) ? it[1..-1] : '') } : '') 
    246242                out << ' </div>' 
    247243                out << ' <div class="input">' 
    248244                out << renderedElement 
    249                 if (helpText.size() > 0) { 
    250                         out << '        <div class="helpIcon"></div>' 
    251                 } 
     245                out << ((helpText.size() > 0) ? '       <div class="helpIcon"></div>' : '') 
    252246 
    253247                // add an disabled input box for feedback purposes 
     
    850844                        // render template fields 
    851845                        entity.giveFields().each() { 
    852                                 def ucName              = it.name[0].toUpperCase() + it.name.substring(1) 
     846                                // Format the column name by: 
     847                                // - separating combined names (SampleName --> Sample Name) 
     848                                // - capitalizing every seperate word 
     849                                def ucName = it.name.replaceAll(/[a-z][A-Z][a-z]/) { 
     850                                        it[0] + ' ' + it[1..2] 
     851                                }.replaceAll(/\w+/) { 
     852                                        it[0].toUpperCase() + ((it.size() > 1) ? it[1..-1] : '') 
     853                                } 
    853854 
    854855                                out << '<div class="' + attrs.get('class') + '">' + ucName + (it.unit ? " (${it.unit})" : '') 
  • trunk/grails-app/views/wizard/pages/_events.gsp

    r778 r804  
    3131        </wizard:radioElement> 
    3232        <wizard:templateElement name="eventTemplate" elementId="eventTemplate" description="Event Template" value="${event?.template}" entity="${dbnp.studycapturing.Event}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" > 
    33                 The template to use for this study 
     33                The template to use for this event 
    3434        </wizard:templateElement> 
    35         <wizard:templateElement name="sampleTemplate" elementId="sampleTemplate" description="Sample Template" value="${event?.template}" entity="${dbnp.studycapturing.SamplingEvent}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" > 
    36                 The template to use for this study 
     35        <wizard:templateElement name="sampleTemplate" elementId="sampleTemplate" description="Sampling Event Template" value="${event?.template}" entity="${dbnp.studycapturing.SamplingEvent}" addDummy="true" ajaxOnChange="switchTemplate" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="onWizardPage()" > 
     36                The template to use for this sampling event 
    3737        </wizard:templateElement> 
    3838        <g:if test="${event?.template}">