Changeset 1056
- Timestamp:
- Nov 3, 2010, 12:58:27 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/TemplateFieldType.groovy
r959 r1056 10 10 */ 11 11 public enum TemplateFieldType implements Serializable { 12 STRING('String' ),// string13 TEXT('Long string' ),// text14 INTEGER('Integer number' ), // integer15 FLOAT('Floating-point number' ), // float16 DOUBLE('Double precision floating-point number' ), // double17 STRINGLIST('List of items' ),// string list18 ONTOLOGYTERM('Ontology Reference' ),// ontology reference19 DATE('Date' ), // date20 RELTIME('Relative time' ),// relative date, e.g. days since start of study21 FILE('File' ), // file22 BOOLEAN('Boolean' ),// boolean23 TEMPLATE('Template' ),// template24 MODULE('Module' ),// third party connected module,25 LONG('Long number' ) // long12 STRING('String','Text', ''), // string 13 TEXT('Long string', 'Text', ''), // text 14 INTEGER('Integer number', 'Numerical', '1'), // integer 15 FLOAT('Floating-point number', 'Numerical', '1.0'), // float 16 DOUBLE('Double precision floating-point number', 'Numerical', '1.0'), // double 17 STRINGLIST('List of items', 'Text', ''), // string list 18 ONTOLOGYTERM('Ontology Reference', 'Other', ''), // ontology reference 19 DATE('Date', 'Date', '2010-01-01'), // date 20 RELTIME('Relative time', 'Date', '3 days'), // relative date, e.g. days since start of study 21 FILE('File', 'Other', '') , // file 22 BOOLEAN('Boolean', 'Other', 'true/false'), // boolean 23 TEMPLATE('Template', 'Other', ''), // template 24 MODULE('Module', 'Other', ''), // third party connected module, 25 LONG('Long number', 'Numerical', '100') // long 26 26 // TODO: add a timezone-aware date type to use for study start date 27 27 28 28 String name 29 String category 30 String example 29 31 30 32 TemplateFieldType(String name) { 31 33 this.name = name 34 } 35 TemplateFieldType(String name, String category, String example) { 36 this.name = name 37 this.category = category 38 this.example = example 32 39 } 33 40 -
trunk/grails-app/views/templateEditor/compare.gsp
r1029 r1056 36 36 } ); 37 37 } ); 38 39 40 function toggleColumns() 41 { 42 var columns = new Array( 1, 2, 3, 4); 43 44 /* Get the DataTables object again - this is not a recreation, just a get of the object */ 45 var oTable = $('#compare_templates').dataTable(); 46 47 /* Toggle column visibility */ 48 var bVis = oTable.fnSettings().aoColumns[ columns[ 0 ] ].bVisible; 49 $.each( columns, function(index, col) { 50 oTable.fnSetColumnVis( col, bVis ? false : true ); 51 }); 52 53 /* Show large or small titles */ 54 if( bVis ) { 55 // If the columns were visible, they are hidden now and large titles should be shown 56 $( '.shortTitle' ).hide(); 57 $( '.longTitle' ).show(); 58 } else { 59 $( '.longTitle' ).hide(); 60 $( '.shortTitle' ).show(); 61 } 62 } 38 63 </script> 39 64 … … 50 75 </h1> 51 76 77 <p> 78 If you want more space or more information, try to <a class="toggle" href="#" onClick="toggleColumns(); return false;">toggle columns</a>. 79 </p> 80 52 81 <table id="list"></table> 53 82 <div id="pager"></div> 54 83 84 <% /* Length of long titles depends on the number of templates. 85 We've got about 90 characters to show in total */ 86 def numCharsLongTitle = Math.floor( 90 / templates.size() ); 87 %> 55 88 <table id="compare_templates"> 56 89 <thead> … … 62 95 <th>Required</th> 63 96 <g:each in="${templates}" var="currentTemplate"> 64 <th title="${currentTemplate.name}">${currentTemplate.name.substring(0,3)}...</th> 97 <th title="${currentTemplate.name}"> 98 <span class="shortTitle"> 99 <g:if test="${currentTemplate.name.size() > 5}"> 100 ${currentTemplate.name.substring(0,3)}... 101 </g:if> 102 <g:else> 103 ${currentTemplate.name} 104 </g:else> 105 </span> 106 <span class="longTitle"> 107 <g:if test="${currentTemplate.name.size() > numCharsLongTitle}"> 108 ${currentTemplate.name.substring(0,numCharsLongTitle - 3)}... 109 </g:if> 110 <g:else> 111 ${currentTemplate.name} 112 </g:else> 113 </span> 114 </th> 65 115 </g:each> 66 116 </tr> … … 77 127 <td style="text-align: center;" align="center"> 78 128 <g:if test="${currentTemplate.fields.contains(field)}"> 79 <img align="center" src="${createLinkTo( dir: 'images/icons', file: ' accept.png', plugin: 'famfamfam' )}" alt="X" />129 <img align="center" src="${createLinkTo( dir: 'images/icons', file: 'tick.png', plugin: 'famfamfam' )}" alt="X" /> 80 130 </g:if> 81 131 </td> -
trunk/grails-app/views/templateEditor/elements/_boolean.gsp
r959 r1056 13 13 * $Date$ 14 14 */ 15 %> 16 True/False 15 %>True/False -
trunk/grails-app/views/templateEditor/elements/_date.gsp
r959 r1056 13 13 * $Date$ 14 14 */ 15 %> 16 Date 15 %>Date -
trunk/grails-app/views/templateEditor/elements/_double.gsp
r959 r1056 13 13 * $Date$ 14 14 */ 15 %> 16 Double 15 %>Double -
trunk/grails-app/views/templateEditor/elements/_fieldForm.gsp
r959 r1056 1 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}" onChange="showExtraFields( ${templateField ? templateField.id : '\'new\''} );" /><br /> 2 <label for="type">Type:</label> 3 <% 4 /* Create a list of field types grouped on category */ 5 def grouped = [:] 6 fieldTypes.each { 7 if( !grouped[ it.category ] ) 8 grouped[ it.category ] = [] 9 10 grouped[ it.category ].add( it ) 11 } 12 %> 13 <select name="type" onChange="showExtraFields( ${templateField ? templateField.id : '\'new\''} );"> 14 <g:each in="${grouped}" var="group"> 15 <optgroup label="${group.key}"> 16 <g:each in="${group.value}" var="field"> 17 <option 18 <g:if test="${templateField?.type == field}">selected="selected"</g:if> 19 value="${field}">${field} <g:if test="${field.example}">(${field.example})</g:if></option> 20 </g:each> 21 </optgroup> 22 </g:each> 23 </select> 24 25 <br /> 3 26 4 27 <div class="extra stringlist_options" <g:if test="${templateField?.type.toString() == 'STRINGLIST'}">style='display: block;'</g:if>> -
trunk/grails-app/views/templateEditor/elements/_integer.gsp
r959 r1056 13 13 * $Date$ 14 14 */ 15 %> 16 Integer 15 %>Integer -
trunk/web-app/css/templateEditor.css
r1027 r1056 110 110 } 111 111 112 .sorting_asc { 113 background:url("../images/icons/sort_asc.png") no-repeat scroll right center transparent; 114 } 115 .sorting_desc { 116 background:url("../images/icons/sort_desc.png") no-repeat scroll right center transparent; 117 } 118 .sorting { 119 background:url("../images/icons/sort_both.png") no-repeat scroll right center transparent; 120 } 121 .sorting_asc_disabled { 122 background:url("../images/icons/sort_asc_disabled.png") no-repeat scroll right center transparent; 123 } 124 .sorting_desc_disabled { 125 background:url("../images/icons/sort_desc_disabled.png") no-repeat scroll right center transparent; 126 } 127 128 #compare_templates th {white-space: nowrap;} 129 .longTitle { display: none; } 112 130 113 131 -
trunk/web-app/js/templateEditor.js
r996 r1056 55 55 } 56 56 57 58 /** 59 * Clears the form after adding a template 60 */ 61 function clearTemplateForm( id ) { 62 $( '#template_' + id + '_form input#name' ).val( "" ); 63 $( '#template_' + id + '_form textarea' ).val( "" ); 64 } 65 57 66 /** 58 67 * Creates a new template using AJAX … … 70 79 type: "POST", 71 80 success: function(data, textStatus, request) { 72 hideTemplateForm( id ); 81 clearTemplateForm( id ); 82 hideTemplateForm( id ); 73 83 addTemplateListItem( data.id, data.html ); 74 84 }, … … 236 246 237 247 /** 248 * Clears the form to add a template field after adding one 249 */ 250 function clearTemplateFieldForm( id ) { 251 $( '#templateField_' + id + '_form input#name' ).val( "" ); 252 $( '#templateField_' + id + '_form input#unit' ).val( "" ); 253 $( '#templateField_' + id + '_form input#required' ).attr( "checked", "" ); 254 $( '#templateField_' + id + '_form textarea' ).val( "" ); 255 $( '#templateField_' + id + '_form select' ).attr( 'selectedIndex', 0 ); 256 $( '#templateField_' + id + '_form .extra' ).hide(); 257 } 258 259 /** 238 260 * Adds a new template field using AJAX 239 261 */ … … 251 273 type: "POST", 252 274 success: function(data, textStatus, request) { 275 clearTemplateFieldForm( id ); 253 276 hideTemplateFieldForm( id ); 254 277 addFieldListItem( data.id, data.html );
Note: See TracChangeset
for help on using the changeset viewer.