Skip to content

Commit bb232fc

Browse files
committed
Better output if /doc/ search doesn't match anything
- Legacy-Id: 1998
1 parent 6617268 commit bb232fc

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

ietf/idrfc/views_search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def search_results(request):
215215
return HttpResponse("form not valid?", mimetype="text/plain")
216216
x = form.cleaned_data
217217
(results,meta) = search_query(form.cleaned_data)
218+
meta['searching'] = True
218219
if 'ajax' in request.REQUEST and request.REQUEST['ajax']:
219220
return render_to_response('idrfc/search_results.html', {'docs':results, 'meta':meta}, context_instance=RequestContext(request))
220221
else:

ietf/templates/idrfc/search_main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h1>Internet-Drafts and RFCs</h1>
4343
</div>
4444

4545
<div id="search_results">
46-
{% if docs %}
46+
{% if meta.searching %}
4747
{% include "idrfc/search_results.html" %}
4848
{% endif %}
4949
</div>

ietf/templates/idrfc/search_results.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% comment %}
2-
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
2+
Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
33
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
44

55
Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,10 @@
3535
{% if meta.max %}
3636
<p><b>Too many documents match the query! Returning partial result only.</b></p>
3737
{% endif %}
38+
{% if not docs %}
39+
<p><b>No documents match your query.</b></p>
40+
{% else %}
3841
{% regroup docs by view_sort_group as grouped_docs %}
39-
4042
<table class="ietf-table ietf-doctable">
4143
<tr><th class="doc">Document</th><th class="title">Title</th><th class="date">Date</th><th class="status" colspan="2">Status</th><th class="ad">Area Director</th></tr>
4244
{% for doc_group in grouped_docs %}
@@ -48,3 +50,4 @@
4850

4951
{% endfor %}
5052
</table>
53+
{% endif %}

0 commit comments

Comments
 (0)