Ignore:
Timestamp:
Feb 2, 2010, 10:31:25 AM (13 years ago)
Author:
duh
Message:
  • temporary commit
File:
1 edited

Legend:

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

    r145 r157  
    289289                // fetch all species
    290290                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)
    291295
    292296                // got a name?
     
    328332        }
    329333
    330         def templateColumnHeaders = { attrs, body ->
    331                 TemplateSubjectField.findAll().each() {
    332                         out << '<div class="column">' + it + '</div>'
    333                 }
    334         }
    335 
     334        /**
     335         * render table headers for all subjectFields in a template
     336         * @param Map attributes
     337         */
     338        def templateColumnHeaders = { attrs ->
     339                def template = attrs.remove('template')
     340
     341                // output table headers for template fields
     342                template.subjectFields.each() {
     343                        out << '<div class="' + attrs.get('class') + '">' + it + '</div>'
     344                }
     345        }
     346
     347        /**
     348         * render table input elements for all subjectFields in a template
     349         * @param Map attributes
     350         */
    336351        def templateColumns = { attrs, body ->
    337352                def subjectId = attrs.remove('id')
    338                
    339                 // for now, fetch them all
    340                 // also, this should probably be cached to reduce database load...
    341                 TemplateSubjectField.findAll().each() {
    342                         out << '<div class="column">'
    343                         out << '<input type="text">'
     353                def template = attrs.remove('template')
     354
     355                // output columns for these subjectFields
     356                template.subjectFields.each() {
     357                        println it.type
     358                        out << '<div class="' + attrs.get('class') + '">'
     359
     360                        switch (it.type) {
     361                                case 'STRINGLIST':
     362                                        // render stringlist subjectfield
     363                                        out << '<select><option>TODO</option></select>'
     364                                        break;
     365                                case 'INTEGER':
     366                                        // render integer subjectfield
     367                                        out << '<input type="text" value="TODO">'
     368                                        break;
     369                                default:
     370                                        // unsupported field type
     371                                        out << '<b>!! ' + it.type + '</b>'
     372                                        break;
     373                        }
    344374                        out << '</div>'
    345375                }
Note: See TracChangeset for help on using the changeset viewer.