Forum search
[edumed.git] / forum / templates / forum / search_results.html
diff --git a/forum/templates/forum/search_results.html b/forum/templates/forum/search_results.html
new file mode 100644 (file)
index 0000000..b656a40
--- /dev/null
@@ -0,0 +1,41 @@
+{% extends 'pybb/base.html' %}
+{% load i18n %}
+
+
+{% block content %}
+    
+        <h1>{% trans 'Search' %}</h1>
+        <form method="get">
+            {{form.q}}
+            <tr>
+                <td>&nbsp;</td>
+                <td>
+                    <input type="submit" value="{% trans 'Search' %}">
+                </td>
+            </tr>
+        </form>
+
+    {% if query %}
+        <hr/>
+        {% for result in page.object_list %}
+            <p class="search-result">
+                <strong>Temat:</strong> <a href="{{ result.object.get_absolute_url }}">{{ result.object.topic.name }}</a><br/>
+                {% autoescape off %}
+                {% for snippet in result.highlighted.text %}
+                    {{snippet}}{% if not forloop.last %} <strong>...</strong> {% endif %}
+                {% endfor %}
+                {% endautoescape %}
+            </p>
+        {% empty %}
+            <p>Brak wyników.</p>
+        {% endfor %}
+
+        {% if page.has_previous or page.has_next %}
+            <div>
+                {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Poprzednie{% if page.has_previous %}</a>{% endif %}
+                |
+                {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Następne &raquo;{% if page.has_next %}</a>{% endif %}
+            </div>
+        {% endif %}
+    {% endif %}
+{% endblock %}
\ No newline at end of file