|
| 1 | +<#assign pojoNameLower = pojo.shortName.substring(0,1).toLowerCase()+pojo.shortName.substring(1)> |
| 2 | +${'<#assign dateExists = false>'} |
| 3 | +${'<#import "/spring.ftl" as spring/>'} |
| 4 | +${'<#assign xhtmlCompliant = true in spring>'} |
| 5 | + |
| 6 | +<head> |
| 7 | + <title>${'<@spring'}.message "${pojoNameLower}Detail.title"/></title> |
| 8 | + <meta name="heading" content="${'<@spring'}.message "${pojoNameLower}Detail.heading"/>"/> |
| 9 | +</head> |
| 10 | + |
| 11 | +<div class="col-sm-3"> |
| 12 | + <h2>${'<@spring'}.message "${pojoNameLower}Detail.heading"/></h2> |
| 13 | + ${'<@spring'}.message "${pojoNameLower}Detail.message"/> |
| 14 | +</div> |
| 15 | + |
| 16 | +<div class="col-sm-6"> |
| 17 | +${'<@spring'}.bind "${pojoNameLower}.*"/> |
| 18 | +${'<#if'} spring.status.error> |
| 19 | + <div class="alert alert-danger alert-dismissable"> |
| 20 | + <a href="#" data-dismiss="alert" class="close">×</a> |
| 21 | + ${'<#list'} spring.status.errorMessages as error> |
| 22 | + ${'$'}{error}<br/> |
| 23 | + ${'</#list>'} |
| 24 | + </div> |
| 25 | +${'</#if>'} |
| 26 | + |
| 27 | +<form method="post" action="${'<@spring'}.url '/${pojoNameLower}form'/>" id="${pojoNameLower}Form" class="well" autocomplete="off"> |
| 28 | +<#rt/> |
| 29 | +<#foreach field in pojo.getAllPropertiesIterator()> |
| 30 | +<#assign isDate = false> |
| 31 | +<#assign isBoolean = false> |
| 32 | +<#if field.equals(pojo.identifierProperty)> |
| 33 | + <#assign idFieldName = field.name> |
| 34 | + <#if field.value.identifierGeneratorStrategy == "assigned"> |
| 35 | + <#lt/><ul> |
| 36 | + ${'<@spring'}.bind "${pojoNameLower}.${field.name}"/> |
| 37 | + <#if spring.status.error> has-error</#if> |
| 38 | + <div class="form-group${'<#if'} spring.status.error> has-error${'</#if>'}"> |
| 39 | + <label for="${field.name}" class="control-label">${'<@spring'}.message "${pojoNameLower}.${field.name}"/>:</label> |
| 40 | + ${'<@spring'}.formInput "${pojoNameLower}.${field.name}", 'id="${field.name}" class="form-control"'/> |
| 41 | + ${'<@spring'}.showErrors "<br/>", "help-block"/> |
| 42 | + </div> |
| 43 | + <#else> |
| 44 | + <#lt/>${'<@spring'}.formHiddenInput "${pojoNameLower}.${field.name}"/> |
| 45 | + </#if> |
| 46 | +<#elseif !c2h.isCollection(field) && !c2h.isManyToOne(field) && !c2j.isComponent(field)> |
| 47 | + <#foreach column in field.getColumnIterator()> |
| 48 | + <#if field.value.typeName == "java.util.Date" || field.value.typeName == "date"> |
| 49 | + <#assign isDate = true> |
| 50 | + </#if> |
| 51 | + <#if field.value.typeName == "boolean" || field.value.typeName == "java.lang.Boolean"> |
| 52 | + <#assign isBoolean = true> |
| 53 | + </#if> |
| 54 | + ${'<@spring'}.bind "${pojoNameLower}.${field.name}"/> |
| 55 | + <div class="form-group${'<#if'} spring.status.error> has-error${'</#if>'}<#if isBoolean> checkbox</#if>"> |
| 56 | + <#if isBoolean> |
| 57 | + <label for="${field.name}"> |
| 58 | + <#else> |
| 59 | + <label for="${field.name}" class="control-label">${'<@spring'}.message "${pojoNameLower}.${field.name}"/>:</label> |
| 60 | + </#if> |
| 61 | + <#if isDate> |
| 62 | + <#assign dateExists = true/> |
| 63 | + ${'<@spring'}.formInput "${pojoNameLower}.${field.name}", 'id="${field.name}" size="11" title="date" class="form-control date" datepicker="true"'/> |
| 64 | + <#elseif isBoolean> |
| 65 | + ${'<@spring'}.formCheckbox "${pojoNameLower}.${field.name}", 'id="${field.name}"'/> |
| 66 | + <#else> |
| 67 | + ${'<@spring'}.formInput "${pojoNameLower}.${field.name}", 'id="${field.name}" class="form-control"<#if (column.length > 0)> maxlength="${column.length?c}"</#if>'/> |
| 68 | + </#if> |
| 69 | + <#if isBoolean> |
| 70 | + ${'<@spring'}.message "${pojoNameLower}.${field.name}"/></label> |
| 71 | + </#if> |
| 72 | + ${'<@spring'}.showErrors "<br/>", "help-block"/> |
| 73 | + </div> |
| 74 | + </#foreach> |
| 75 | +<#elseif c2h.isManyToOne(field)> |
| 76 | + <#foreach column in field.getColumnIterator()> |
| 77 | + <#lt/> <!-- todo: change this to read the identifier field from the other pojo --> |
| 78 | + <#lt/> <!--@spring.formSingleSelect "${pojoNameLower}.${field.name}", ${pojoNameLower}.${field.name}, 'class="form-control"'/--> |
| 79 | + </#foreach> |
| 80 | +</#if> |
| 81 | +</#foreach> |
| 82 | + |
| 83 | + <div class="form-group"> |
| 84 | + <button type="submit" class="btn btn-primary" id="save" name="save"> |
| 85 | + <i class="icon-ok icon-white"></i> ${'<@spring'}.message "button.save"/> |
| 86 | + </button> |
| 87 | + ${'<#if'} ${pojoNameLower}.${idFieldName}?exists> |
| 88 | + <button type="submit" class="btn btn-danger" id="delete" name="delete"> |
| 89 | + <i class="icon-trash icon-white"></i> ${'<@spring'}.message "button.delete"/> |
| 90 | + </button> |
| 91 | + ${'</#if>'} |
| 92 | + <a href="${'$'}{rc.contextPath}/${util.getPluralForWord(pojoNameLower)}" class="btn btn-default"> |
| 93 | + <i class="icon-remove"></i> ${'<@spring'}.message "button.cancel"/></a> |
| 94 | + </div> |
| 95 | +</form> |
| 96 | +</div> |
| 97 | + |
| 98 | + |
| 99 | +<#if dateExists><#rt/> |
| 100 | +<link rel="stylesheet" type="text/css" media="all" href="${'$'}{rc.contextPath}/webjars/bootstrap-datepicker/1.3.1/css/datepicker.css" /> |
| 101 | +<script type="text/javascript" src="${'$'}{rc.contextPath}/webjars/bootstrap-datepicker/1.3.1/js/bootstrap-datepicker.js"></script> |
| 102 | +${'<#if'} rc.locale.language != 'en'> |
| 103 | +<script type="text/javascript" src="${'$'}{rc.contextPath}/webjars/bootstrap-datepicker/1.3.1/js/locales/bootstrap-datepicker.${r"${rc.locale.language}"}.js'/>"></script> |
| 104 | +${'</#if>'} |
| 105 | +</#if><#rt/> |
| 106 | +<script type="text/javascript"> |
| 107 | + $(document).ready(function() { |
| 108 | + $("input[type='text']:visible:enabled:first", document.forms['${pojoNameLower}Form']).focus(); |
| 109 | +<#if dateExists> |
| 110 | + ${'$'}('.date').datepicker({format: "${'<@spring'}.message "calendar.format"/>", weekStart: "${'<@spring'}.message "calendar.weekstart"/>", language: '${r"${rc.locale.language}"}'}); |
| 111 | +</#if> |
| 112 | + }); |
| 113 | +</script> |
0 commit comments