Fixing MR-340, if ?Errors doesn't work correctly.
[castle.git] / MonoRail / Castle.MonoRail.ActiveRecordScaffold / Templates / new.vm
blob598fd69a917513659aacd4d3a3500931b9c8a717
1 <h2>New ${model.Type.Name}</h2>
3 #if($flash.errors)
4 <ul id="errors">
5 #foreach($error in $flash.errors)
6   <li>$error</li>
7 #end
8 </ul>
9 #end
11 #if($useModelName)
12 $Form.FormTag("%{action='create${model.Type.Name}', id='scaffoldingform'}")
13 #else
14 $Form.FormTag("%{action='create', id='scaffoldingform'}")
15 #end
17 <div id="scaffoldmain">
19 #foreach($curmodel in $Form.GetModelHierarchy($model, $instance))
21 #if($curmodel.IsNestedType)
22   $Form.FieldSet("${curmodel.Type.Name}:")
23 #end
25 #foreach($field in $curmodel.Fields)
26 #if($Form.CanHandle($field))
27 <div>$Form.CreateControl($curmodel, $prefix, $field, $instance)</div>
28 #end
29 #end
31 #foreach($prop in $curmodel.Properties)
32 #if($Form.CanHandle($prop))
33 <div>$Form.CreateControl($curmodel, $prefix, $prop, $instance)</div>
34 #end
35 #end
37 #foreach($prop in $curmodel.NotMappedProperties)
38 #if($Form.CanHandle($prop))
39 <div>$Form.CreateControl($curmodel, $prefix, $prop, $instance)</div>
40 #end
41 #end
43 #foreach($prop in $curmodel.BelongsTo)
44 #if($Form.CanHandle($prop))
45 <div>$Form.CreateControl($curmodel, $prefix, $prop, $instance)</div>
46 #end
47 #end
49 #foreach($prop in $curmodel.HasMany)
50 #if($Form.CanHandle($prop))
51 <div>$Form.CreateControl($curmodel, $prefix, $prop, $instance)</div>
52 #end
53 #end
55 #foreach($prop in $curmodel.HasAndBelongsToMany)
56 #if($Form.CanHandle($prop))
57 <div valign="top">$Form.CreateControl($curmodel, $prefix, $prop, $instance)</div>
58 #end
59 #end
61 #if($curmodel.IsNestedType)
62   $Form.EndFieldSet()
63 #end
65 #end
67 <input type="submit" value="Create" />
69 </div>
71 <p>
72 $PresentationHelper.LinkToBack("Back", null) | $PresentationHelper.LinkToList($model, $useModelName, "List", null)
73 </p>
75 $Form.EndFormTag()