Changeset 377 for trunk


Ignore:
Timestamp:
Apr 23, 2010, 4:16:44 PM (13 years ago)
Author:
duh
Message:
  • working on the templateEditor
Location:
trunk
Files:
10 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/application.properties

    r374 r377  
    1010plugins.jquery=1.4.1.1
    1111plugins.mail=0.9
    12 #plugins.nadd-neutralizer=0.1
     12plugins.nadd-neutralizer=0.1
    1313plugins.nimble=0.3-SNAPSHOT
    1414plugins.searchable=0.5.5
  • trunk/grails-app/controllers/dbnp/studycapturing/TemplateEditorController.groovy

    r376 r377  
    7777                                                        // fetch all templates to this entity
    7878                                                        flow.templates = Template.findAllByEntity(entity)
     79
     80                                                        // find all template fields for this particular entity
     81                                                        // for now, all
     82                                                        // TODO: limit for this entity only
     83                                                        flow.allTemplateFields = TemplateField.findAll().sort{ it.name }
    7984                                                }
    8085                                        } catch (Exception e) { }
     
    102107                        render(view: "templates")
    103108                        onRender {
    104                                 println "render templates"
     109                                // template parameter given?
     110                                if (params.template) {
     111                                        // yes, find template by name
     112                                        flow.template = Template.findByName(params.template)
     113                                        flow.templateFields = flow.allTemplateFields
     114
     115                                        flow.template.fields.each() {
     116                                                println it
     117                                                flow.templateFields.remove(it)
     118                                               
     119                                        }
     120                                        println "count: "+flow.template.fields.size()
     121
     122                                        println "---"
     123                                        flow.allTemplateFields.each() {
     124                                                println it
     125                                        }
     126                                        println "count: "+flow.allTemplateFields.size()
     127                                        println "---"
     128
     129                                        println flow.allTemplateFields.class
     130                                        println flow.template.fields.class
     131                                        println "---"
     132                                }
    105133                        }
    106134                        on("next").to "start"
  • trunk/grails-app/views/templateEditor/pages/templates.gsp

    r376 r377  
    1818 <head>
    1919  <meta name="layout" content="dialog"/>
    20   <title>my bla</title>
     20  <title>template editor</title>
    2121 </head>
    2222 <body>
    23  templates for entity: ${entity}<br/>
    2423
    25  <g:if test="${templates}">
    26   <ul>
    27   <g:each in="${templates}">
    28      <li>${it}</li>
    29   </g:each>
     24  <script type="text/javascript">
     25         $(function() {
     26                 $("#sortable").sortable({
     27                         placeholder: 'ui-state-highlight'
     28                 });
     29                 $("#sortable").disableSelection();
     30         });
     31  </script>
     32
     33 <g:form action="pages" name="wizardForm" id="wizardForm">
     34  <wizard:templateSelect name="template" description="Template" value="${template}" entity="${dbnp.studycapturing.Study}" addDummy="true" onChange="this.form.submit();" />
     35 </g:form>
     36
     37 <g:if test="${template}">
     38  <ul id="sortable">
     39  <g:render template="elements/all" collection="${template.fields}" />
    3040  </ul>
    3141 </g:if>
     42
     43 add a new field:
     44 <g:select from="${templateFields}" />
    3245 
    3346 </body>
  • trunk/web-app/css/dialog.css

    r373 r377  
    11body {
    22        margin: 0; padding: 0;
    3         font: 10px normal Arial, Helvetica, sans-serif;
     3        font: 12px normal Verdana, Arial, Helvetica, sans-serif;
    44}
     5
     6#sortable { list-style-type: none; margin: 0; padding: 0; width: 200px; }
     7#sortable li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1em; }
     8html>body #sortable li { height: 1.5em; line-height: 1.2em; }
     9.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
Note: See TracChangeset for help on using the changeset viewer.