{#template /layout.html} {#def breadcrumbs} Blog / {:if article/key} {:s article}{=title}{/:s} / Edit article {:e} Create article {/:if} {/#def} {#def content}
{/#def} {#def script} var form = $("#articleform"); form.bind("submit", function (e) { e.preventDefault(); e.stopPropagation(); var f = e.target, errors = {}, params = { key: f.key.value, title: f.title.value, summary: f.summary.value, content: f.content.value, tagsString: f.tagsString.value }; if (!params.title) errors.title = "Please provide a title"; if (!params.content) errors.content = "Please provide the content"; for (var i in errors) { showErrors(form, errors); return false; } $.post("/articles", params, function (res) { if (res.errors) { $("#waiting").remove(); showErrors(form, res.errors); return false; } else { window.location.href = res.uri; } }); form.find("fieldset.submit").append('