Changeset 1182 for trunk/grails-app/taglib
- Timestamp:
- Nov 22, 2010, 5:27:23 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy
r1166 r1182 793 793 out << '<input type="hidden" name="' + attrs.name + '" id="' + attrs.name + '" value="' + attrs.value + '">'; 794 794 out << '<div id="' + attrs.name + 'Example" class="upload_info"></div>'; 795 out << '<a id="' + attrs.name + 'Delete" class="upload_del" href="#" onClick="if( confirm( \'Are you sure to delete this file?\' ) ) { deleteFile( \'' + attrs.name + '\' ); } return false;"><img src="' + resource( dir: 'images/icons', file: 'delete.png', plugin: 'famfamfam' ) + '"></a>'; 795 796 out << '<script type="text/javascript">'; 796 797 out << ' $(document).ready( function() { '; … … 798 799 out << ' fileUploadField( "' + attrs.name + '" );'; 799 800 out << ' if( filename != "" ) {'; 801 out << ' $("#' + attrs.name + 'Delete").show();'; 800 802 out << ' $("#' + attrs.name + 'Example").html("Current file: " + createFileHTML( filename ) )'; 801 803 out << ' }'; … … 1432 1434 } 1433 1435 1436 def showTemplateField = { attrs, body -> 1437 def field = attrs.get( 'field' ); 1438 def entity = attrs.get( 'entity' ); 1439 def fieldName = ''; 1440 def fieldType = ''; 1441 1442 if( entity ) { 1443 if( field instanceof String ) { 1444 fieldName = field; 1445 fieldType = ''; 1446 } else if( field instanceof TemplateField ) { 1447 fieldName = field.name 1448 fieldType = field.type.toString(); 1449 } else { 1450 return; 1451 } 1452 1453 def value = entity.getFieldValue( fieldName ); 1454 1455 if( fieldType == 'FILE' && value != "" ) { 1456 out << '<a href="' + g.createLink( controller: "file", action: "get", id: value ) + '">' + value + '</a>'; 1457 } else { 1458 out << value; 1459 } 1460 1461 } 1462 } 1463 1434 1464 }
Note: See TracChangeset
for help on using the changeset viewer.