Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (41 sloc) 1.508 kB
<@ params.formAction = '/<%= names.filename.plural %>'; @>
<h3>
New <%= names.constructor.singular %>
</h3>
<@ if (params.errors) { @>
<p>
<div>Errors:</div>
<@ for (var p in params.errors) { @>
<div><@= p @>: <@= params.errors[p] @></div>
<@ } @>
</p>
<@ } @>
<@= partial('_form', {params: params}); @>
<script type="text/javascript" src="/js/util/date.js"></script>
<script type="text/javascript" src="/js/util/form.js"></script>
<script type="text/javascript" src="/js/util/meta.js"></script>
<script type="text/javascript" src="/js/util/string.js"></script>
<script type="text/javascript" src="/js/util/url.js"></script>
<script type="text/javascript" src="/js/models/model.js"></script>
<script type="text/javascript" src="/js/models/<%= names.filename.singular %>.js"></script>
<script type="text/javascript">
var displayErrors = function (err) {
var str = '';
for (var p in err) {
str += p + ': ' + err[p] + '\\\\n';
}
alert(str);
};
var validateSubmit = function () {
var form = document.getElementById('modelItemForm');
var params = geddy.util.form.toObject(form);
var item = <%= names.constructor.singular %>.create(params);
console.log(item);
if (item.valid()) {
form.submit();
}
else {
displayErrors(item.errors);
}
};
</script>
Jump to Line
Something went wrong with that request. Please try again.