Commit 680e3da1 by Bridger Maxwell

Getting simplewiki search to work.

parent 61a713f2
......@@ -72,8 +72,35 @@ update_schematics();});
<hr />
<%block name="wiki_panel">
<%
if (wiki_article is not UNDEFINED):
baseURL = reverse("wiki_view", args=[wiki_article.get_url()])
else:
baseURL = reverse("wiki_view", args=[""])
%>
<div id="wiki_panel">
<div class="wiki_box">
<div class="wiki_box_header">
<div class="wiki_box_corner"></div>
<div class="wiki_box_bar"></div>
</div>
<div class="wiki_box_contents">
<div class="wiki_box_title">Search</div>
<form method="POST" action='${reverse("wiki_search_articles", args=[""])}'>
<div style="display:none">
<input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}"/>
</div>
<input type="text" name="value" id="wiki_search_input" style="width: 72%" value="${wiki_search_query if wiki_search_query is not UNDEFINED else '' |h}"/>
<input type="submit" id="wiki_search_input_submit" value=Go! style="width: 20%" />
</form>
</div>
<div class="wiki_box_footer">
<div class="wiki_box_corner"></div>
<div class="wiki_box_bar"></div>
</div>
</div>
<div class="wiki_box">
<div class="wiki_box_header">
<div class="wiki_box_corner"></div>
......@@ -84,11 +111,6 @@ update_schematics();});
<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/'"
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='${baseURL + "/' + " + theaction};">
<h2>Create article</h2>
......
......@@ -2,6 +2,10 @@
<%inherit file="simplewiki_base.html"/>
<%!
from django.core.urlresolvers import reverse
%>
<%block name="wiki_page_title">
Oops...
</%block>
......
......@@ -2,6 +2,10 @@
<%inherit file="simplewiki_base.html"/>
<%!
from django.core.urlresolvers import reverse
%>
<%block name="wiki_page_title">
${ wiki_article.title }
</%block>
......
......@@ -2,6 +2,10 @@
<%inherit file="simplewiki_base.html"/>
<%!
from django.core.urlresolvers import reverse
%>
<%block name="wiki_page_title">
%if wiki_search_query:
Search results for ${wiki_search_query | h}
......@@ -12,7 +16,7 @@
<%block name="wiki_body">
%for article in wiki_search_results:
%if article.get_url:
%if article is not UNDEFINED:
<a href="${reverse("wiki_view", args=[article.get_url()])}">${article.get_url()}</a><br/>
%else:
<a href="${reverse("wiki_view", args=[''])}">/</a><br/>
......@@ -20,6 +24,6 @@
%endfor
%if not wiki_search_results:
No articles were found!
No articles matching <b>${wiki_search_query if wiki_search_query is not UNDEFINED else ""} </b>!
%endif
</%block>
##This file is based on the template from the SimpleWiki source which carries the GPL license
##This file has been converted to Mako, but not tested. It is because uploads are disabled for the wiki. If they are reenabled, this may contain bugs.
<%!
from django.template.defaultfilters import filesizeformat
%>
......
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