Changeset 159


Ignore:
Timestamp:
Feb 2, 2010, 1:58:18 PM (14 years ago)
Author:
duh
Message:
  • tag library now handles (INT and STRINGLIST) templateFields correctly
  • development.js can now reload CSS and JS on the fly (extermely handy for testing within flows)
  • some CSS changes
Location:
trunk
Files:
4 edited

Legend:

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

    r157 r159  
    287287         */
    288288        def speciesSelect = { attrs ->
     289                // fetch the speciesOntology
     290                // note that this is a bit nasty, probably the ontologyName should
     291                // be configured in a configuration file... --> TODO
     292                def speciesOntology = Ontology.findByName('NCBI Taxonomy')
     293
    289294                // fetch all species
    290                 attrs.from = Term.findAll()     // for now, all terms, should be refactored to be species ontology only!
    291                 def speciesOntology = Ontology.findAllByName('NCBI Taxonomy')
    292 
    293                 println speciesOntology
    294                 //println Term.findAllByOntology(speciesOntology)
     295                attrs.from = Term.findAllByOntology(speciesOntology)
    295296
    296297                // got a name?
    297298                if (!attrs.name) {
     299                        // nope, use a default name
    298300                        attrs.name = 'species'
    299301                }
     
    355357                // output columns for these subjectFields
    356358                template.subjectFields.each() {
    357                         println it.type
    358359                        out << '<div class="' + attrs.get('class') + '">'
    359360
     
    361362                                case 'STRINGLIST':
    362363                                        // render stringlist subjectfield
    363                                         out << '<select><option>TODO</option></select>'
     364                                        if (!it.listEntries.isEmpty()) {
     365                                                out << select(
     366                                                        name: it.name,
     367                                                        from: it.listEntries
     368                                                )
     369                                        } else {
     370                                                out << '<span class="error">no values!!</span>'
     371                                        }
    364372                                        break;
    365373                                case 'INTEGER':
    366374                                        // render integer subjectfield
    367                                         out << '<input type="text" value="TODO">'
     375                                        out << textField(
     376                                                name: it.name
     377                                        )
    368378                                        break;
    369379                                default:
    370380                                        // unsupported field type
    371                                         out << '<b>!! ' + it.type + '</b>'
     381                                        out << '<span class="error">unsuported type '+it.type+'</span>'
    372382                                        break;
    373383                        }
  • trunk/web-app/css/wizard.css

    r157 r159  
    169169}
    170170
     171.wizard .table .row .error {
     172    color: red;
     173    font-size: 8px;
     174    height: 10px;
     175}
     176
    171177.wizard .table input, .wizard .table select {
    172178    border: 1px solid #8e908f;
     
    263269.wizard .groups .group .gallery li a.ui-icon-zoomin { float: left; }
    264270.wizard .groups .group .gallery li img { width: 100%; cursor: move; }
     271
     272.wizard .groups .group .gallery {
     273    display: block;
     274    float: left;
     275}
     276
     277.wizard .groups .group .gallery li {
     278    display: inline-block;
     279}
    265280*/
    266 .wizard .groups .group .gallery {
    267     display: block;
    268     float: left;
    269 }
    270 
    271 .wizard .groups .group .gallery li {
    272     display: inline-block;
    273 }
    274 
    275 
    276 
     281
     282.wizard .groups .group ul.gallery {
     283    background-color: red;
     284}
     285
     286
     287
  • trunk/web-app/js/development.js

    r145 r159  
    1313    var d = ''
    1414    d += '<input type="button" class="prevnext" value="reload CSS" onclick="reloadCSS();return false;"/>'
     15    d += '<input type="button" class="prevnext" value="reload JS" onclick="reloadJS();return false;"/>'
     16    d += '<input type="button" class="prevnext" value="reload Both" onclick="reloadBoth();return false;"/>'
    1517
    1618    // insert into footer
    17     $('#footer').html(d + "<br/>"+$('#footer').html())
     19    $('#footer').html(d + "<br/>" + $('#footer').html())
    1820});
     21
     22function reloadBoth() {
     23    reloadCSS();
     24    reloadJS();
     25}
    1926
    2027function reloadCSS() {
     
    2229
    2330    var i,a,s;
    24     a=document.getElementsByTagName('link');
    25     for(i=0;i<a.length;i++) {
    26         s=a[i];
    27         if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href) {
    28             var h=s.href.replace(/(&|\\?)forceReload=d /,'');
    29             s.href=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf());
     31    a = document.getElementsByTagName('link');
     32    for (i = 0; i < a.length; i++) {
     33        s = a[i];
     34        if (s.rel.toLowerCase().indexOf('stylesheet') >= 0 && s.href) {
     35            var h = s.href.replace(/(&|\\?)forceReload=d /, '');
     36            s.href = h + (h.indexOf('?') >= 0 ? '&' : '?') + 'forceReload=' + (new Date().valueOf());
    3037        }
    3138    }
    3239}
     40
     41function reloadJS() {
     42    console.log('reloading js...');
     43
     44    var i,j,a,s;
     45    var head = document.getElementsByTagName('head')[0];
     46    var ignore = [
     47        /development.js/,
     48        /topnav.js/,
     49        /jquery/,
     50        /login_panel.js/
     51    ];
     52
     53    a = document.getElementsByTagName('script');
     54    for (i = a.length - 1; i >= 0; i--) {
     55        s = a[i];
     56
     57        // check if this script should be skipped
     58        var deleteIt = true;
     59        for (j = 0; j < ignore.length; j++) {
     60            if (ignore[j].test(s.src)) {
     61                deleteIt = false;
     62                break;
     63            }
     64        }
     65
     66        // delete this script and reload it?
     67        if (deleteIt) {
     68            // delete it
     69            head.removeChild(s)
     70
     71            // and load it again
     72            var script = document.createElement('script');
     73            script.type = 'text/javascript';
     74            script.src = s.src
     75            head.appendChild(script);
     76        }
     77    }
     78}
  • trunk/web-app/js/wizard.js

    r157 r159  
    2020        // http://code.google.com/p/fbug/issues/detail?id=1899
    2121        var wizard = $('div#wizard')
    22         wizard.html('<span style="color:red;font-size:8px;">Firefox 3.6 contains <a href="http://code.google.com/p/fbug/issues/detail?id=2746" target="_new">a bug</a> in combination with Firebug\'s XMLHttpRequest spy which causes the wizard to not function anymore. Please make sure you have firebug\'s XMLHttpRequest spy disabled use use Firefox 3.5.7 instead...</span>' + wizard.html())
     22        if (wizard.find("#warning").length == 0) {
     23            wizard.html('<span id="warning" style="color:red;font-size:8px;">Firefox 3.6 contains <a href="http://code.google.com/p/fbug/issues/detail?id=2746" target="_new">a bug</a> in combination with Firebug\'s XMLHttpRequest spy which causes the wizard to not function anymore. Please make sure you have firebug\'s XMLHttpRequest spy disabled use use Firefox 3.5.7 instead...</span>' + wizard.html())
     24        }
    2325    }
    2426
     
    4951
    5052        // handle special content
    51         var specialContent = helpContent.html().match(/\[([^:]+)\:([^\]]+)\]/)
    52         if (specialContent) {
    53             // replace content by calling a helper function
    54             eval(specialContent[1] + "('" + specialContent[2] + "',helpContent)");
    55         }
    56 
    57         // attach tooltip
    58         helpIcon.qtip({
    59             content: 'leftMiddle',
    60             position: {
    61                 corner: {
    62                     tooltip: 'leftMiddle',
    63                     target: 'rightMiddle'
     53        var html = (helpContent.html()) ? helpContent.html() : '';
     54        if (html) {
     55            var specialContent = html.match(/\[([^:]+)\:([^\]]+)\]/)
     56            if (specialContent) {
     57                // replace content by calling a helper function
     58                eval(specialContent[1] + "('" + specialContent[2] + "',helpContent)");
     59            }
     60
     61            // attach tooltip
     62            helpIcon.qtip({
     63                content: 'leftMiddle',
     64                position: {
     65                    corner: {
     66                        tooltip: 'leftMiddle',
     67                        target: 'rightMiddle'
     68                    }
     69                },
     70                style: {
     71                    border: {
     72                        width: 5,
     73                        radius: 10
     74                    },
     75                    padding: 10,
     76                    textAlign: 'center',
     77                    tip: true,
     78                    name: 'blue'
     79                },
     80                content: helpContent.html(),
     81                show: 'mouseover',
     82                hide: 'mouseout',
     83                api: {
     84                    beforeShow: function() {
     85                        // not used at this moment
     86                    }
    6487                }
    65             },
    66             style: {
    67                 border: {
    68                     width: 5,
    69                     radius: 10
    70                 },
    71                 padding: 10,
    72                 textAlign: 'center',
    73                 tip: true,
    74                 name: 'blue'
    75             },
    76             content: helpContent.html(),
    77             show: 'mouseover',
    78             hide: 'mouseout',
    79             api: {
    80                 beforeShow: function() {
    81                     // not used at this moment
    82                 }
    83             }
    84         })
    85 
    86         // remove helpcontent div as we don't need it anymore
    87         helpContent.remove();
     88            })
     89
     90            // remove helpcontent div as we don't need it anymore
     91            helpContent.remove();
     92        }
    8893    });
    8994}
     
    128133                    $(this).removeClass('highlight');
    129134                }
    130         )
     135                )
    131136    });
    132137}
     
    197202        accept: '.subjects > ol > li',
    198203        drop: function(event, ui) {
    199             /*
    200             $(this).addClass('ui-state-highlight').find('p').html('Dropped!');
    201 deleteImage(ui.draggable);
    202             function deleteImage($item) {
    203                 $item.fadeOut(function() {
    204                     var $list = $('ul',$trash).length ? $('ul',$trash) : $('<ul class="gallery ui-helper-reset"/>').appendTo($trash);
    205 
    206                     $item.find('a.ui-icon-trash').remove();
    207                     $item.append(recycle_icon).appendTo($list).fadeIn(function() {
    208                         $item.animate({ width: '48px' }).find('img').animate({ height: '36px' });
    209                     });
    210                 });
    211             }
    212 */
    213 
    214             //console.log($(this))
    215             //console.log(ui.draggable)
    216204            var group = $(this)
    217             var list = $('ul',group).length ? $('ul',group) : $('<ul class="gallery ui-helper-reset"/>').appendTo(group);
     205            var list = $('ul', group).length ? $('ul', group) : $('<ul class="henk"/>').appendTo(group);
    218206
    219207            // append selected subjects to this group
     
    221209                // append to group
    222210                $(this).appendTo(list);
    223 
    224                 // make undraggable
    225                 /*
    226                 $(this).draggable('destroy');
    227 
    228                 //$(this).css({ 'position': 'absolute' });
    229 
    230                 // make all visible
    231                 $(this).animate(
    232                     {opacity: 100},
    233                     200
    234                 );
    235                 */
    236211            });
    237 
    238212
    239213
     
    270244                            if (this != d) {
    271245                                $(this).animate(
    272                                     { opacity: 0 },
    273                                     200
    274                                 );
     246                                { opacity: 0 },
     247                                        200
     248                                        );
    275249                            }
    276250                        });
     
    284258                            if (this != d) {
    285259                                $(this).animate(
    286                                     {opacity: 100},
    287                                     200
    288                                 );
     260                                {opacity: 100},
     261                                        200
     262                                        );
    289263                            }
    290264                        });
Note: See TracChangeset for help on using the changeset viewer.