..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 | {% extends 'blog/partials/base.html' %} {% block content %}
{% load get_list %}
<table id="search" cellpadding="0" cellspacing="0">
<tr>
<td id="search_sidebar" style="width: 200px; vertical-align: top;">
<form method="get" url="{% url 'blog:search' %}">
<h2>Search</h2>
<input type="text" name="q" value="{{ request.GET.q }}" placeholder="Query" style="width: 180px; display: block; margin: 10px 0;" required/>
<h2 class="mtsbitem">Search In</h2>
<input type="checkbox" name="search_in" value="posts" {% if 'posts' in search_in %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="search_in" style="vertical-align: middle;">Posts</label><br>
<input type="checkbox" name="search_in" value="users" {% if 'users' in search_in %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="search_in" style="vertical-align: middle;">Users</label><br>
<input type="checkbox" name="search_in" value="comments" {% if 'comments' in search_in %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="search_in" style="vertical-align: middle;">Comments</label><br>
<h2 class="mtsbitem">Sort By</h2>
<input type="radio" name="sort_by" value="relevance" {% if sort_by == 'relevance' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="sort_by" style="vertical-align: middle;">Relevance</label><br>
<input type="radio" name="sort_by" value="date" {% if sort_by == 'date' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="sort_by" style="vertical-align: middle;">Date</label><br>
{% comment %} <input type="radio" name="sort_by" value="popularity" {% if sort_by == 'popularity' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="sort_by" style="vertical-align: middle;">Popularity</label><br> {% endcomment %}
<h2 class="mtsbitem">Order</h2>
<input type="radio" name="order" value="ascending" {% if order == 'ascending' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="order" style="vertical-align: middle;">Ascending</label><br>
<input type="radio" name="order" value="descending" {% if order == 'descending' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="order" style="vertical-align: middle;">Descending</label><br>
<h2 class="mtsbitem">Date Range</h2>
<input type="radio" name="date_range" value="any" {% if date_range == 'any' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="date_range" style="vertical-align: middle;">Any</label><br>
<input type="radio" name="date_range" value="past_day" {% if date_range == 'past_day' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="date_range" style="vertical-align: middle;">Past Day</label><br>
<input type="radio" name="date_range" value="past_week" {% if date_range == 'past_week' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="date_range" style="vertical-align: middle;">Past Week</label><br>
<input type="radio" name="date_range" value="past_month" {% if date_range == 'past_month' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="date_range" style="vertical-align: middle;">Past Month</label><br>
<input type="radio" name="date_range" value="past_year" {% if date_range == 'past_year' %}checked{% endif %} style="margin: 5px 10px 5px 0px; vertical-align: middle;"/><label for="date_range" style="vertical-align: middle;">Past Year</label><br>
<input type="submit" value="Search" class="button button-special" style="margin: 10px 0;"/>
</form>
</td>
<td id="search_results" style="width: 530px; max-width: 530px; vertical-align: top; padding-left: 20px;">
<h2>Search Results</h2>
<style>
div > pre {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
<p style="margin-bottom: 20px;">Your search for "<strong>{{ request.GET.q }}</strong>" returned {{ search_results }} Result{% if search_results != 1 %}s{% endif %}.</p>
{% if 'posts' in search_in %}
<h2 style="background: #311b4f; margin: 0 0 10px 0; border: dotted 1px white; padding: 5px;">Posts</h2>
{% if posts|length != 0 %}
{% include 'blog/partials/search/post_list.html' %}
{% else %}
<p>No matching posts found.</p>
{% endif %}
{% endif %}
{% if 'users' in search_in %}
<h2 style="background: #311b4f; margin: 0 0 10px 0; border: dotted 1px white; padding: 5px;">Users</h2>
{% if users|length != 0 %}
{% include 'blog/partials/search/user_list.html' %}
{% else %}
<p>No matching users found.</p>
{% endif %}
{% endif %}
{% if 'comments' in search_in %}
<h2 style="background: #311b4f; margin: 0 0 10px 0; border: dotted 1px white; padding: 5px;">Comments</h2>
{% if comments|length != 0 %}
{% include 'blog/partials/search/comment_list.html' %}
{% else %}
<p>No matching comments found.</p>
{% endif %}
{% endif %}
</td>
</tr>
</table>
{% endblock %}
{% block scripts %}
{% include 'blog/partials/mathjax.html' %}
{% endblock %}
|
|