Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TAlone
memopol
Commits
b2747903
Commit
b2747903
authored
Jun 17, 2016
by
Nicolas Joyard
Browse files
Add no results message and test
parent
f02e9913
Changes
3
Hide whitespace changes
Inline
Side-by-side
memopol/tests/test_representatives_list.py
View file @
b2747903
...
...
@@ -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'
)
static/scss/filter.scss
View file @
b2747903
...
...
@@ -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
templates/representatives/representative_list.haml
View file @
b2747903
...
...
@@ -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'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment