Commit 67fc2586 by Bridger Maxwell

Fixed bugs in templates. Now working as they were originally, but with Mako.

parent 4ca87c44
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
document.getElementById('wiki_related_input_id').value = s.id; document.getElementById('wiki_related_input_id').value = s.id;
document.getElementById('wiki_related_input_submit').disabled=false; document.getElementById('wiki_related_input_submit').disabled=false;
} }
%if wiki_article is not UNDEFINED:
var x = window.onload; var x = window.onload;
window.onload = function(){ window.onload = function(){
var options = { var options = {
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
if (typeof x == 'function') if (typeof x == 'function')
x(); x();
} }
%endif
</script> </script>
<script type="text/x-mathjax-config"> <script type="text/x-mathjax-config">
MathJax.Hub.Config({ MathJax.Hub.Config({
...@@ -188,14 +190,19 @@ text-decoration: none; ...@@ -188,14 +190,19 @@ text-decoration: none;
<div style="border: 2px outset #CCC; width: 250px; padding: 10px; background-color: #FFF; position: absolute; right: 100px; top: -80px; display: none; color: #000;" id="wiki_create_form"> <div style="border: 2px outset #CCC; width: 250px; padding: 10px; background-color: #FFF; position: absolute; right: 100px; top: -80px; display: none; color: #000;" id="wiki_create_form">
<% <%
theaction = "this.wiki_article_name.value.replace(/([^a-zA-Z0-9\-])/g, '')+'/_create/'" theaction = "this.wiki_article_name.value.replace(/([^a-zA-Z0-9\-])/g, '')+'/_create/'"
if (wiki_article is not UNDEFINED):
baseURL = reverse("wiki_view", args=[wiki_article.get_url()])
else:
baseURL = reverse("wiki_view", args=[""])
%> %>
<form method="GET" onsubmit="this.action='${reverse("wiki_view", args=[wiki_article.get_url()])}/' + ${theaction};"> <form method="GET" onsubmit="this.action='${baseURL + "/' + " + theaction};">
<h2>Create article</h2> <h2>Create article</h2>
<p> <p>
<label for="id_wiki_article_name">Title of article</label> <label for="id_wiki_article_name">Title of article</label>
<input type="text" name="wiki_article_name" id="id_wiki_article_name" /><br/> <input type="text" name="wiki_article_name" id="id_wiki_article_name" /><br/>
<label for="id_wiki_article_is_child">Create as a child of current article</label> <label for="id_wiki_article_is_child">Create as a child of current article</label>
<input type="checkbox" name="wiki_article_is_child" id="id_wiki_artcile_is_child" disabled="true" checked=${ "yes" if wiki_article else "no" }> <input type="checkbox" name="wiki_article_is_child" id="id_wiki_artcile_is_child" disabled="true" ${ 'checked="checked"' if wiki_article is not UNDEFINED else ""}>
</p> </p>
<p> <p>
<input type="button" class="button" value="Cancel" style="display: inline-block; margin-right: 2px;" onclick="document.getElementById('wiki_create_form').style.display='none';" /> <input type="button" class="button" value="Cancel" style="display: inline-block; margin-right: 2px;" onclick="document.getElementById('wiki_create_form').style.display='none';" />
...@@ -205,15 +212,15 @@ text-decoration: none; ...@@ -205,15 +212,15 @@ text-decoration: none;
</div> </div>
<p> <p>
%if wiki_article: %if wiki_article is not UNDEFINED:
<input type="button" onclick="javascript:location.href='${reverse("wiki_view", args=[wiki_article.get_url()])}'" value="View" style="width: 100%;" /><br /> <input type="button" onclick="javascript:location.href='${reverse("wiki_view", args=[wiki_article.get_url()])}'" value="View" style="width: 100%;" /><br />
<input type="button" onclick="javascript:location.href='${reverse("wiki_edit", args=[wiki_article.get_url()])}'" value="Edit" style="width: 100%;"${'disabled="true"' if not wiki_write else ""}/><br /> <input type="button" onclick="javascript:location.href='${reverse("wiki_edit", args=[wiki_article.get_url()])}'" value="Edit" style="width: 100%;"${'disabled="true"' if not wiki_write else ""}/><br />
<input type="button" onclick="javascript:location.href='${reverse("wiki_history", args=[wiki_article.get_url(),1])}'" value="History" style="width: 100%;" /> <input type="button" onclick="javascript:location.href='${reverse("wiki_history", args=[wiki_article.get_url(),1])}'" value="History" style="width: 100%;" />
%endif %endif
<input type="button" onclick="document.getElementById('wiki_create_form').style.display='block';" value="Create article" style="width: 100%; margin-bottom: 2px;" class="button" /> <input type="button" onclick="document.getElementById('wiki_create_form').style.display='block';" value="Create article" style="width: 100%; margin-bottom: 2px;" class="button" />
<input type="button" onclick="javascript:location.href='${reverse("wiki_random", args=[wiki_article.get_url()])}'" value="Random article" style="width: 100%; margin-bottom: 2px;" class="button" /> <input type="button" onclick="javascript:location.href='${reverse("wiki_random", args=["wiki_articleget_url"])}'" value="Random article" style="width: 100%; margin-bottom: 2px;" class="button" />
</p> </p>
%if wiki_article: %if wiki_article is not UNDEFINED:
%if wiki_article.locked: %if wiki_article.locked:
<p><strong>This article has been locked</strong></p> <p><strong>This article has been locked</strong></p>
%endif %endif
......
...@@ -7,15 +7,12 @@ Oops... ...@@ -7,15 +7,12 @@ Oops...
<%block name="wiki_body"> <%block name="wiki_body">
<div class="wiki_error"> <div class="wiki_error">
%if wiki_error is not UNDEFINED:
${wiki_error} ${wiki_error}
%if wiki_err_notfound:
%endif %endif
%if wiki_err_notfound: %if wiki_err_notfound is not UNDEFINED:
%if wiki_url: %if wiki_url is not UNDEFINED:
<p> <p>
The page you requested could not be found. The page you requested could not be found.
Click <a href="{% url wiki_create wiki_url %}">here</a> to create it. Click <a href="{% url wiki_create wiki_url %}">here</a> to create it.
...@@ -29,7 +26,7 @@ Click <a href="{% url wiki_create "" %}">here</a> to create it. ...@@ -29,7 +26,7 @@ Click <a href="{% url wiki_create "" %}">here</a> to create it.
</p> </p>
%endif %endif
%else: %else:
%if wiki_err_noparent: %if wiki_err_noparent is not UNDEFINED:
<p> <p>
You cannot create this page, because its parent You cannot create this page, because its parent
does not exist. Click <a href="${reverse("wiki_create", args=[wiki_url_parent])}">here</a> does not exist. Click <a href="${reverse("wiki_create", args=[wiki_url_parent])}">here</a>
...@@ -37,43 +34,43 @@ to create it. ...@@ -37,43 +34,43 @@ to create it.
</p> </p>
%else: %else:
%if wiki_err_keyword: %if wiki_err_keyword is not UNDEFINED:
<p> <p>
The page you're trying to create <b>${wiki_url}</b> starts with <b>_</b>, which is reserved for internal use. The page you're trying to create <b>${wiki_url}</b> starts with <b>_</b>, which is reserved for internal use.
</p> </p>
%else: %else:
%if wiki_err_locked: %if wiki_err_locked is not UNDEFINED:
<p> <p>
The article you are trying to modify is locked. The article you are trying to modify is locked.
</p> </p>
%else: %else:
%if wiki_err_noread: %if wiki_err_noread is not UNDEFINED:
<p> <p>
You do not have access to read this article. You do not have access to read this article.
</p> </p>
%else: %else:
%if wiki_err_nowrite: %if wiki_err_nowrite is not UNDEFINED:
<p> <p>
You do not have access to edit this article. You do not have access to edit this article.
</p> </p>
%else: %else:
%if wiki_err_noanon: %if wiki_err_noanon is not UNDEFINED:
<p> <p>
Anonymous attachments are not allowed. Try logging in. Anonymous attachments are not allowed. Try logging in.
</p> </p>
%else: %else:
%if wiki_err_create: %if wiki_err_create is not UNDEFINED:
<p> <p>
You do not have access to create this article. You do not have access to create this article.
</p> </p>
%else: %else:
%if wiki_err_encode: %if wiki_err_encode is not UNDEFINED:
<p> <p>
The url you requested could not be handled by the wiki. The url you requested could not be handled by the wiki.
Probably you used a bad character in the URL. Probably you used a bad character in the URL.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment