[GMG-Devel] [PATCH 48/83] Modify search template to show tabbed results.

Alon Levy alon at pobox.com
Tue Feb 25 14:58:30 EST 2014


From: Praveen Kumar <praveen97uma at gmail.com>

---
 .../templates/mediagoblin/search/search.html       | 33 ++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/mediagoblin/templates/mediagoblin/search/search.html b/mediagoblin/templates/mediagoblin/search/search.html
index 224d68a..681e616 100644
--- a/mediagoblin/templates/mediagoblin/search/search.html
+++ b/mediagoblin/templates/mediagoblin/search/search.html
@@ -1,6 +1,19 @@
 {% extends "mediagoblin/base.html" %}
 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
 
+{% block mediagoblin_head %}
+<link rel="stylesheet" type="text/css"
+    href="{{ request.staticdirect('/css/extlib/jquery-ui.css') }}" />
+<script type="text/javascript"
+    src="{{ request.staticdirect('/js/extlib/jquery-ui.js') }}"></script>
+<script>
+ $(document).ready(function() {
+    $( "#tabs" ).tabs();
+});
+</script>
+{% endblock mediagoblin_head %}
+
+
 
 {% block mediagoblin_content %}    
     <form action="{{ request.urlgen('mediagoblin.plugins.search.search') }}" method="POST">
@@ -11,13 +24,23 @@
         </div>
     </form>
     {% if results_found %}
-        {% if results %}
+        {% if result_categories %}
             <h2> Results found for query: {{ query }} </h2>
-            <ul>
-                {% for result in results %}
-                    <li><a href = "{{ result['url'] }} "> {{ result['slug'] }}</a></li>
+
+            <div id="tabs">
+                <ul>
+                    {% for category in result_categories %}
+                        <li><a href="#{{ category['css_id'] }}"> {{ category['verbose_name'] }} </li>
+                    {% endfor %}
+                </ul>
+                {% for category in result_categories %}
+                    <div id="#{{ category['css_id'] }}">
+                        {% for result in category['results'] %}
+                            <li><a href = "{{ result['url'] }} "> {{ result['slug'] }}</a></li>
+                        {% endfor %}
+                    </div>
                 {% endfor %}
-            </ul>
+            </div>
         {% else %}
             No results found for query: {{ query }}
         {% endif %}
-- 
1.8.5.3



More information about the devel mailing list