Ignore:
Timestamp:
Jun 11, 2010, 4:00:10 PM (12 years ago)
Author:
roberth
Message:

Improved template editor , stringlists and ontologyfields can be edited and extra checks are built in.

Location:
trunk/grails-app/views/templateEditor/elements
Files:
3 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/templateEditor/elements/_available.gsp

    r556 r558  
    1 <li class="ui-state-default" id="templateField_${it.id}">
    2     <g:render template="elements/liField" model="['templateField': it, 'fieldTypes': fieldTypes]"/>
     1<li class="ui-state-default <g:if test="${templateField.required}">required</g:if>" id="templateField_${templateField.id}">
     2    <g:render template="elements/liField" model="['templateField': templateField, 'ontologies': ontologies, 'fieldTypes': fieldTypes]"/>
    33</li>
  • trunk/grails-app/views/templateEditor/elements/_disabledFieldForm.gsp

    r555 r558  
    1         <label for="name">Name:</label> <g:textField name="name" value="${templateField?.name}" /><br />
    2         <label for="type">Type:</label> <g:select from="${fieldTypes}" name="type" value="${templateField?.type}" /><br />
    3         <label for="unit">Unit:</label> <g:textField name="unit" value="${templateField?.unit}" /><br />
    4         <label for="comment">Comment:</label> <g:textArea name="comment" value="${templateField?.comment}" /><br />
    5         <label for="required">Required:</label> <g:checkBox name="required" value="${templateField?.required}" /><br />
     1        <label for="name">Name:</label> <g:textField disabled="disabled" name="name" value="${templateField?.name}" /><br />
     2        <label for="type">Type:</label> <g:textField disabled="disabled" name="type" value="${templateField?.type}" /><br />
     3
     4        <div class="extra stringlist_options" <g:if test="${templateField?.type.toString() == 'STRINGLIST'}">style='display: block;'</g:if>>
     5          <label for="type">Items:</label>
     6                <g:textArea name="listEntries" disabled="disabled" value="${templateField?.listEntries?.name?.join( '\n' )}" />
     7        </div>
     8        <div class="extra ontologyterm_options" <g:if test="${templateField?.type.toString() == 'ONTOLOGYTERM'}">style='display: block;'</g:if>>
     9          <label for="type">Ontology:</label> <g:textArea name="ontology" disabled="disabled" value="${templateField?.ontologies?.name?.join( '\n' )}" /><br />
     10        </div>
     11       
     12        <label for="unit">Unit:</label> <g:textField disabled="disabled" name="unit" value="${templateField?.unit}" /><br />
     13        <label for="comment">Comment:</label> <g:textArea disabled="disabled" name="comment" value="${templateField?.comment}" /><br />
     14        <label for="required">Required:</label> <input type="checkbox" disabled <g:if test="${templateField?.required}">checked</g:if><br />
  • trunk/grails-app/views/templateEditor/elements/_fieldForm.gsp

    r544 r558  
    11        <label for="name">Name:</label> <g:textField name="name" value="${templateField?.name}" /><br />
    2         <label for="type">Type:</label> <g:select from="${fieldTypes}" name="type" value="${templateField?.type}" /><br />
     2        <label for="type">Type:</label> <g:select from="${fieldTypes}" name="type" value="${templateField?.type}" onChange="showExtraFields( ${templateField ? templateField.id : '\'new\''} );" /><br />
     3
     4        <div class="extra stringlist_options" <g:if test="${templateField?.type.toString() == 'STRINGLIST'}">style='display: block;'</g:if>>
     5          <label for="type">Items (every item on a new line):</label>
     6                <g:textArea name="listEntries" value="${templateField?.listEntries?.name?.join( '\n' )}" />
     7        </div>
     8        <div class="extra ontologyterm_options" <g:if test="${templateField?.type.toString() == 'ONTOLOGYTERM'}">style='display: block;'</g:if>>
     9          <label for="type">Ontology:<br /><br /><a href="#" style="text-decoration: underline;" onClick="openOntologyDialog();">Add new</a></label>
     10                <g:select multiple="yes" size="5" from="${ontologies}" class="ontologySelect" optionValue="name" optionKey="id" name="ontologies" id="ontologies_${templateField?.id}" value="${templateField?.ontologies}" /><br />
     11        </div>
     12
    313        <label for="unit">Unit:</label> <g:textField name="unit" value="${templateField?.unit}" /><br />
    414        <label for="comment">Comment:</label> <g:textArea name="comment" value="${templateField?.comment}" /><br />
  • trunk/grails-app/views/templateEditor/elements/_liField.gsp

    r556 r558  
    11<g:if test="${templateField.inUse()}">
    2         <g:render template="elements/liFieldInUse" model="['templateField': templateField, 'fieldTypes': fieldTypes]"/>
     2        <g:render template="elements/liFieldInUse" model="['templateField': templateField, 'ontologies': ontologies, 'fieldTypes': fieldTypes]"/>
    33</g:if>
    44<g:else>
    5         <g:render template="elements/liFieldNotInUse" model="['templateField': templateField, 'fieldTypes': fieldTypes]"/>
     5        <g:render template="elements/liFieldNotInUse" model="['templateField': templateField, 'ontologies': ontologies, 'fieldTypes': fieldTypes]"/>
    66</g:else>
  • trunk/grails-app/views/templateEditor/elements/_liFieldInUse.gsp

    r556 r558  
    11<g:set var="numUses" value="${templateField.numUses()}" />
    22<span class="listButtons">
    3   <img class="disabled" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/application_edit.png')}" alt="Editing not possible. Field is used in ${numUses} templates." title="Editing not possible. Field is used in ${numUses} templates.">
     3  <img onClick="showTemplateFieldForm( 'templateField_' + ${templateField.id}); this.blur(); return false;" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/application_edit.png')}" alt="Edit template field properties" title="Edit template field properties">
    44  <img class="disabled" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/delete.png')}" alt="Deleting this field is not possible. Field is used in ${numUses} templates." title="Deleting this field is not possible. Field is used in ${numUses} templates.">
    5   <img onClick="addTemplateField( ${templateField.id} ); moveFieldListItem( ${templateField.id}, '#selectedTemplateFields' );" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/add.png')}" alt="Add field to template" title="Add field to template">
     5  <img onClick="addTemplateField( ${templateField.id}, null, true );" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/add.png')}" alt="Add field to template" title="Add field to template">
    66</span>
    77
     
    99    (<g:if test="${templateField.unit}">${templateField.unit}, </g:if><g:render template="elements/${templateField.type.toString().toLowerCase().replaceAll(/ /,'_')}" model="[templateField: templateField]"/>)
    1010   
     11<form class="templateField_form" id="templateField_${templateField.id}_form" action="updateField">
     12        <g:hiddenField name="id" value="${templateField.id}" />
     13        <g:hiddenField name="version" value="${templateField.version}" />
     14        <p class="noEditsPossible">Editing not possible. Field is used in ${numUses} template(s).</p>
     15        <g:render template="elements/disabledFieldForm" model="['templateField': templateField, 'ontologies': ontologies, 'fieldTypes': fieldTypes]"/>
     16        <div class="templateFieldButtons">
     17                <input type="button" value="Close" onClick="hideTemplateFieldForm( ${templateField.id} );">
     18        </div>
     19</form>
    1120
  • trunk/grails-app/views/templateEditor/elements/_liFieldNotInUse.gsp

    r556 r558  
    22  <img onClick="showTemplateFieldForm( 'templateField_' + ${templateField.id}); this.blur(); return false;" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/application_edit.png')}" alt="Edit template field properties" title="Edit template field properties">
    33  <img onClick="if( confirm( 'Are you sure?' ) ) { deleteTemplateField( ${templateField.id} ); }" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/delete.png')}" alt="Delete this template field" title="Delete this template field">
    4   <img onClick="addTemplateField( ${templateField.id} ); moveFieldListItem( ${templateField.id}, '#selectedTemplateFields' );" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/add.png')}" alt="Add field to template" title="Add field to template">
     4  <img onClick="addTemplateField( ${templateField.id}, null, true );" src="${createLinkTo( dir: 'images', file: 'icons/famfamfam/add.png')}" alt="Add field to template" title="Add field to template">
    55</span>
    66
     
    1111        <g:hiddenField name="id" value="${templateField.id}" />
    1212        <g:hiddenField name="version" value="${templateField.version}" />
    13         <g:render template="elements/fieldForm" model="['templateField': templateField, 'fieldTypes': fieldTypes]"/>
     13        <g:render template="elements/fieldForm" model="['templateField': templateField, 'ontologies': ontologies, 'fieldTypes': fieldTypes]"/>
    1414        <div class="templateFieldButtons">
    1515                <input type="button" value="Save" onClick="updateTemplateField( ${templateField.id} );">
  • trunk/grails-app/views/templateEditor/elements/_selected.gsp

    r556 r558  
    1 <li class="ui-state-default <g:if test="${template.inUse()}">inUse</g:if>" id="templateField_${it.id}">
    2     <g:render template="elements/liFieldSelected" model="['templateField': it, 'template': template, 'fieldTypes': fieldTypes]"/>
     1<li class="ui-state-default  <g:if test="${templateField.required}">required</g:if>" id="templateField_${templateField.id}">
     2    <g:render template="elements/liFieldSelected" model="['templateField': templateField, 'template': template, 'fieldTypes': fieldTypes]"/>
    33</li>
Note: See TracChangeset for help on using the changeset viewer.