Changeset 1269 for trunk


Ignore:
Timestamp:
Dec 15, 2010, 1:20:43 PM (13 years ago)
Author:
robert@…
Message:

Fixed bug in importing templates without any fields and improved views (ticket #76)

Location:
trunk
Files:
5 edited

Legend:

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

    r1257 r1269  
    101101                        def templateData = templates.find { template -> template.key == id.toLong() }
    102102                        def importTemplate = templateData?.template
    103                         println id + ": " + templateData
    104103
    105104                        if( !importTemplate ) {
  • trunk/grails-app/domain/dbnp/studycapturing/Template.groovy

    r1264 r1269  
    141141
    142142                // Check all template fields
    143                 if( otherTemplate.fields?.size() != this.fields?.size() )
     143                def size1 = otherTemplate.fields?.size() ?: 0
     144                def size2 = otherTemplate.fields?.size() ?: 0
     145                if( size1 != size2 ) {
    144146                        return false
     147                }
    145148
    146149                if( otherTemplate.fields != null && this.fields != null ) {
  • trunk/grails-app/views/template/handleImportedFile.gsp

    r1257 r1269  
    2929                                </td>
    3030                                <td>
     31                                  <g:if test="${templateData.template.fields?.size() > 0}">
    3132                                  <ol class="fields">
    3233                                        <g:each in="${templateData.template.fields}" var="field">
     
    3435                                        </g:each>
    3536                                  </ol>
     37                                  </g:if>
     38                                  <g:else>
     39                                        (no fields)
     40                                  </g:else>
    3641                                </td>
    3742                                <td>
  • trunk/grails-app/views/template/xml.gsp

    r1263 r1269  
    3535                                        <g:each in="${field.listEntries}" var="listEntry">
    3636                                          <listItem>
    37                                                   <g:if test="${listEntry}"><name>${listEntry.name?.encodeAsSimpleXML()}</name></g:if>
     37                                                  <name><g:if test="${listEntry}">${listEntry.name?.encodeAsSimpleXML()}</g:if></name>
    3838                                          </listItem>
    3939                                        </g:each>
  • trunk/web-app/css/templateEditor.css

    r1257 r1269  
    137137/* Importer */
    138138#importTemplates h3 { margin-top: 0; }
    139 #importTemplates ol.fields { margin-top: 0; }
     139#importTemplates ol { margin-left: 0; padding-left: 0; }
     140#importTemplates ol.fields { margin-left: 25px; margin-top: 0; }
     141#importTemplates ul { margin-left: 0px; padding-left: 15px; }
     142#importTemplate li { margin-left: 0; padding-left: 0; }
    140143#importTemplates .otherTemplateName { display: none; }
    141144#importTemplates .error { color: #AA0000; }
Note: See TracChangeset for help on using the changeset viewer.