2009-09-10 07:50:51 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
<form action="{{ request.path }}" method="post" class="compose">
|
2013-03-03 17:09:29 +00:00
|
|
|
<div style="margin-bottom:5px"><input name="title" type="text" class="title" value="{{ entry.title if entry else "" }}"/></div>
|
|
|
|
<div style="margin-bottom:5px"><textarea name="markdown" rows="30" cols="40" class="markdown">{{ entry.markdown if entry else "" }}</textarea></div>
|
2009-09-10 07:50:51 +00:00
|
|
|
<div>
|
|
|
|
<div style="float:right"><a href="http://daringfireball.net/projects/markdown/syntax">{{ _("Syntax documentation") }}</a></div>
|
|
|
|
<input type="submit" value="{{ _("Save changes") if entry else _("Publish post") }}" class="submit"/>
|
|
|
|
<a href="{{ "/entry/" + entry.slug if entry else "/" }}">{{ _("Cancel") }}</a>
|
|
|
|
</div>
|
|
|
|
{% if entry %}
|
|
|
|
<input type="hidden" name="id" value="{{ entry.id }}"/>
|
|
|
|
{% end %}
|
2013-03-03 17:09:29 +00:00
|
|
|
{% module xsrf_form_html() %}
|
2009-09-10 07:50:51 +00:00
|
|
|
</form>
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block bottom %}
|
|
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
//<![CDATA[
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
$("input[name=title]").select();
|
|
|
|
$("form.compose").submit(function() {
|
|
|
|
var required = ["title", "markdown"];
|
|
|
|
var form = $(this).get(0);
|
|
|
|
for (var i = 0; i < required.length; i++) {
|
|
|
|
if (!form[required[i]].value) {
|
|
|
|
$(form[required[i]]).select();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//]]>
|
|
|
|
</script>
|
|
|
|
{% end %}
|