Commit b2747903 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Add no results message and test

parent f02e9913
......@@ -122,3 +122,6 @@ class RepresentativeListTest(UrlGetTestMixin, TestCase):
def test_filter_multiple(self):
self.filter_test('e', 110, 1, 17)
def test_filter_notfound(self):
self.filter_test('non-existing-rep-name')
......@@ -59,4 +59,12 @@
}
}
}
}
.no-results {
margin-top: 1em;
font-size: larger;
font-weight: bold;
color: #555;
margin: 2em 0;
}
\ No newline at end of file
......@@ -15,47 +15,53 @@
{% url 'representative-list' as action_url %}
- include 'representatives/_filter_form.html' with action=action_url form=filter.form qs=request.GET.urlencode
- include 'core/blocks/pagination.html'
- block list
%table.table
%tr
%th
- trans 'Photo'
%th
- trans 'Name'
%th
- trans 'Chamber'
%th
- trans 'Country'
%th
- trans 'Group'
%th
- trans 'Score'
- for representative in object_list
%tr.representative_item{'class': '{{ representative.active|yesno:"active,inactive" }}'}
%td.photo
%a{'href': "{% url 'representative-detail' representative.slug %}"}
%img{'src': '={representative.photo}', 'width': '80'}/
%td
%a{'href': "{% url 'representative-detail' representative.slug %}"}
= representative.full_name
%td
%a{'href': "{% chamber_url representative.chamber %}"}
= representative.chamber
%td
%a{'href': "{% country_url representative.country %}"}
= representative.country
%td
%a{'href': "{% group_url representative.main_mandate.group %}"}
= representative.main_mandate.group|group_icon
%td
= representative.score.score|score_label
- include 'core/blocks/pagination.html'
- if object_list|length == 0
.no-results="No matching representatives found :("
- else
- include 'core/blocks/pagination.html'
- block list
%table.table
%tr
%th
- trans 'Photo'
%th
- trans 'Name'
%th
- trans 'Chamber'
%th
- trans 'Country'
%th
- trans 'Group'
%th
- trans 'Score'
- for representative in object_list
%tr.representative_item{'class': '{{ representative.active|yesno:"active,inactive" }}'}
%td.photo
%a{'href': "{% url 'representative-detail' representative.slug %}"}
%img{'src': '={representative.photo}', 'width': '80'}/
%td
%a{'href': "{% url 'representative-detail' representative.slug %}"}
= representative.full_name
%td
%a{'href': "{% chamber_url representative.chamber %}"}
= representative.chamber
%td
%a{'href': "{% country_url representative.country %}"}
= representative.country
%td
%a{'href': "{% group_url representative.main_mandate.group %}"}
= representative.main_mandate.group|group_icon
%td
= representative.score.score|score_label
- include 'core/blocks/pagination.html'
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