Changeset 1040


Ignore:
Timestamp:
Nov 1, 2010, 6:11:23 PM (12 years ago)
Author:
j.a.m.wesbeek@…
Message:
  • made column widths changeable by adding:

columnWidths="[Name:200, Species: 150, MyColumnName: 300]"

where the key is the CamelCased? column name without spaces (and info)
resolves issue #152

Location:
trunk
Files:
4 edited

Legend:

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

    r990 r1040  
    2020 */
    2121class WizardTagLib extends JavascriptTagLib {
    22 
    23         def AuthenticationService
     22        def AuthenticationService
    2423       
    2524        // define the tag namespace (e.g.: <wizard:action ... />
     
    853852                def entity              = (attrs.get('entity'))
    854853                def template    = (entity && entity instanceof TemplateEntity) ? entity.template : null
     854                def columnWidths= (attrs.get('columnWidths')) ? attrs.remove('columnWidths') : []
    855855
    856856                // got a template?
     
    867867                                }
    868868
    869                                 out << '<div class="' + attrs.get('class') + '">' + ucName + (it.unit ? " (${it.unit})" : '')
     869                                // strip spaces
     870                                def ucNameSpaceless = ucName.replaceAll(/ /) { '' }
     871
     872                                // do we have to use a specific width for this column?
     873                                if (columnWidths[ucName]) {
     874                                        out << '<div class="' + attrs.get('class') + '" style="width:' + columnWidths[ucNameSpaceless] + 'px;" rel="resized">' + ucName + (it.unit ? " (${it.unit})" : '')
     875                                } else {
     876                                        out << '<div class="' + attrs.get('class') + '">' + ucName + (it.unit ? " (${it.unit})" : '')
     877                                }
    870878                                if (it.comment) {
    871879                                        out << '<div class="helpIcon"></div>'
  • trunk/grails-app/views/wizard/pages/_groups.gsp

    r959 r1040  
    2626                <div class="header">
    2727                        <div class="column">Template</div>
    28                         <div class="column">Subjects</div>
     28                        <div class="column" style="width:150px;" rel="resized">Subjects</div>
    2929                        <g:if test="${study.eventGroups}"><g:each var="eventGroup" in="${study.eventGroups}">
    3030                                <div class="column">
  • trunk/grails-app/views/wizard/pages/_subjects.gsp

    r998 r1040  
    5050                                <div class="header">
    5151                                  <div class="firstColumn"></div>
    52                                   <wizard:templateColumnHeaders class="column" entity="${subject}" />
     52                                  <wizard:templateColumnHeaders class="column" entity="${subject}" columnWidths="[Name:200, Species: 150]" />
    5353                                </div>
    5454                                </g:if>
  • trunk/web-app/js/wizard.js

    r1037 r1040  
    248248        var column = 0;
    249249        var columns = [];
     250        var resized = [];
    250251
    251252        // calculate total width of elements in header
     
    265266
    266267            // remember column
     268            resized[ column ] = (c.attr('rel') == 'resized');
    267269            columns[ column ] = c.width();
    268270            column++;
     
    278280            var column = 0;
    279281            row.children().each(function() {
    280                 $(this).css({ width: columns[ column] + 'px' });
     282                var child = $(this);
     283                child.css({ width: columns[ column] + 'px' });
     284                if (resized[ column ]) {
     285                    $(':input',child).each(function() {
     286                        $(this).css({width: (columns[ column ] - 10) + 'px'});
     287                    });
     288                }
    281289                column++;
    282290            });
Note: See TracChangeset for help on using the changeset viewer.