The wiki creation page now uses the edit template, so it has the unsaved changes confirmation and Codemirror editor.
This commit is contained in:
@@ -154,10 +154,11 @@ def create(request, wiki_url):
|
||||
|
||||
d = {'wiki_form': f,
|
||||
'wiki_write': True,
|
||||
'create_article' : True,
|
||||
}
|
||||
d.update(csrf(request))
|
||||
|
||||
return render_to_response('simplewiki_create.html', d)
|
||||
return render_to_response('simplewiki_edit.html', d)
|
||||
|
||||
def edit(request, wiki_url):
|
||||
if not request.user.is_authenticated():
|
||||
@@ -207,6 +208,7 @@ def edit(request, wiki_url):
|
||||
'wiki_article': article,
|
||||
'wiki_title' : article.title,
|
||||
'wiki_attachments_write': article.can_attach(request.user),
|
||||
'create_article' : False,
|
||||
}
|
||||
d.update(csrf(request))
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
##This file is based on the template from the SimpleWiki source which carries the GPL license
|
||||
|
||||
<%inherit file="simplewiki_base.html"/>
|
||||
|
||||
<%block name="title"><title>Wiki – Create Article – MITx 6.002x</title></%block>
|
||||
|
||||
<%block name="wiki_page_title">
|
||||
<h1>Create article</h1>
|
||||
</%block>
|
||||
|
||||
<%block name="wiki_body">
|
||||
<form method="POST" id="wiki_revision">
|
||||
<div style="display:none">
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
|
||||
</div>
|
||||
|
||||
${ wiki_form }
|
||||
|
||||
<input type="submit" value="Create article" /></td>
|
||||
</form>
|
||||
|
||||
<%include file="simplewiki_instructions.html"/>
|
||||
|
||||
</%block>
|
||||
@@ -2,22 +2,30 @@
|
||||
|
||||
<%inherit file="simplewiki_base.html"/>
|
||||
|
||||
<%block name="title"><title>${"Edit " + wiki_title + " - " if wiki_title is not UNDEFINED else ""}MITx 6.002x Wiki</title></%block>
|
||||
<%block name="title">
|
||||
<title>
|
||||
%if create_article:
|
||||
Wiki – Create Article – MITx 6.002x
|
||||
%else:
|
||||
${"Edit " + wiki_title + " - " if wiki_title is not UNDEFINED else ""}MITx 6.002x Wiki
|
||||
%endif
|
||||
</title></%block>
|
||||
|
||||
<%block name="wiki_page_title">
|
||||
%if create_article:
|
||||
<h1>Create article</h1>
|
||||
%else:
|
||||
<h1>${ wiki_article.title }</h1>
|
||||
%endif
|
||||
</%block>
|
||||
|
||||
<%block name="wiki_head">
|
||||
|
||||
|
||||
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/codemirror.js"></script>
|
||||
<link rel="stylesheet" href="${ settings.LIB_URL }CodeMirror/codemirror.css" />
|
||||
|
||||
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/xml.js"></script>
|
||||
<script type="text/javascript" src="${ settings.LIB_URL }CodeMirror/mitx_markdown.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.CodeMirror-scroll {
|
||||
min-height: 550px;
|
||||
@@ -68,8 +76,12 @@
|
||||
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
|
||||
</div>
|
||||
${wiki_form}
|
||||
%if create_article:
|
||||
<input type="submit" id="submit_edit" value="Create article" /></td>
|
||||
%else:
|
||||
<input type="submit" id="submit_edit" name="edit" value="Save Changes" />
|
||||
<input type="submit" id="submit_delete" name="delete" value="Delete article" />
|
||||
%endif
|
||||
</form>
|
||||
|
||||
<%include file="simplewiki_instructions.html"/>
|
||||
|
||||
Reference in New Issue
Block a user