Files
edx-platform/templates/simplewiki_edit.html
2012-03-30 05:49:32 -07:00

78 lines
2.1 KiB
HTML

##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>${"Edit " + wiki_title + " - " if wiki_title is not UNDEFINED else ""}MITx 6.002x Wiki</title></%block>
<%block name="wiki_page_title">
<h1>${ wiki_article.title }</h1>
</%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;
width: 100%;
}
.CodeMirror {
border: 1px solid black;
text-align: left;
}
</style>
<script>
$(function(){
$(document).ready(function() {
var editor = CodeMirror.fromTextArea(document.getElementById("id_contents"), {
mode: 'mitx_markdown',
matchBrackets: true,
theme: "default",
lineWrapping: true,
});
//Store the inital contents so we can compare for unsaved changes
var initial_contents = editor.getValue();
window.onbeforeunload = function askConfirm() { //Warn the user before they navigate away
if ( editor.getValue() != initial_contents ) {
return "You have made changes to the article that have not been saved yet.";
}
};
$("#submit_edit").click(function() {
initial_contents = editor.getValue();
});
});
});
</script>
</%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" id="submit_edit" name="edit" value="Save Changes" />
<input type="submit" id="submit_delete" name="delete" value="Delete article" />
</form>
<%include file="simplewiki_instructions.html"/>
</%block>