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
Simon Daron
panikweb
Commits
3ef012f9
Commit
3ef012f9
authored
Oct 17, 2013
by
fred
Browse files
search: uniform search filters
parent
2a96656f
Changes
5
Hide whitespace changes
Inline
Side-by-side
panikweb/search.py
View file @
3ef012f9
...
...
@@ -142,6 +142,11 @@ class SearchView(FacetedSearchView):
context
[
'selected_tags'
]
=
[
x
.
split
(
':'
,
1
)[
1
]
for
x
in
self
.
request
.
GET
.
getlist
(
'selected_facets'
)
if
x
.
startswith
(
'tags_exact'
)]
context
[
'facets'
][
'fields'
][
'categories'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'categories'
]
if
x
[
1
]
>
0
]
context
[
'facets'
][
'fields'
][
'categories'
].
sort
()
context
[
'facets'
][
'fields'
][
'tags'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'tags'
]
if
x
[
1
]
>
0
]
return
context
sqs
=
SearchQuerySet
().
models
(
Emission
,
Episode
,
NewsItem
).
facet
(
'categories'
).
facet
(
'tags'
)
...
...
@@ -180,7 +185,11 @@ class ListenArchivesView(FacetedSearchView):
context
[
'selected_tags'
]
=
[
x
.
split
(
':'
,
1
)[
1
]
for
x
in
self
.
request
.
GET
.
getlist
(
'selected_facets'
)
if
x
.
startswith
(
'tags_exact'
)]
context
[
'facets'
][
'fields'
][
'categories'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'categories'
]
if
x
[
1
]
>
0
]
context
[
'facets'
][
'fields'
][
'categories'
].
sort
()
context
[
'facets'
][
'fields'
][
'tags'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'tags'
]
if
x
[
1
]
>
0
]
return
context
listenArchives
=
search_view_factory
(
ListenArchivesView
)
...
...
@@ -214,6 +223,11 @@ class NewsArchivesView(FacetedSearchView):
context
[
'selected_tags'
]
=
[
x
.
split
(
':'
,
1
)[
1
]
for
x
in
self
.
request
.
GET
.
getlist
(
'selected_facets'
)
if
x
.
startswith
(
'tags_exact'
)]
context
[
'facets'
][
'fields'
][
'news_categories'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'news_categories'
]
if
x
[
1
]
>
0
]
context
[
'facets'
][
'fields'
][
'news_categories'
].
sort
()
context
[
'facets'
][
'fields'
][
'tags'
]
=
[
x
for
x
in
context
[
'facets'
][
'fields'
][
'tags'
]
if
x
[
1
]
>
0
]
return
context
newsArchives
=
search_view_factory
(
NewsArchivesView
)
panikweb_templates/static/css/specifics.css
View file @
3ef012f9
...
...
@@ -1126,9 +1126,11 @@ ul.newsSpecial{
font-style
:
italic
;
}
.
newsFilters
.count-0
{
display
:
none
!important
;
.
search-filters
{
text-align
:
justify
;
}
/****************************************************/
/**** GRILLE ****/
/****************************************************/
...
...
panikweb_templates/templates/listen/archives.html
View file @
3ef012f9
...
...
@@ -11,17 +11,18 @@ pri, ei viris quaestio concludaturque qui, cu copiosae senserit quo. Cu dictas
officiis has, hinc libris aliquam pro te.
</p>
<div
class=
"search-filters"
>
{% if facets.fields.categories %}
<nav>
<ul
class=
"custom padded"
>
<li><span
class=
"mainLabel"
>
Genre :
</span></li>
{% for category in facets.fields.categories %}
<li>
{% if category.0 in selected_categories %}
<a
class=
"check icon-check
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|remove_category_facet:category.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_category_facet:category.0 }}"
>
{{ category.0 }} | {{ category.1 }}
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|append_category_facet:category.0 }}"
>
{{ category.0 }} | {{ category.1 }}
</a></span>
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_category_facet:category.0 }}"
>
{{ category.0 }} | {{ category.1 }}
</a></span>
{% endif %}
</li>
{% endfor %}
...
...
@@ -32,21 +33,22 @@ officiis has, hinc libris aliquam pro te.
{% if facets.fields.tags %}
<nav>
<ul
class=
"tag-facets custom padded"
>
<li><span
class=
"mainLabel"
>
Mots
clés :
</span></li>
<li><span
class=
"mainLabel"
>
Mots
-
clés :
</span></li>
{% for tag in facets.fields.tags|slice:":20" %} {# Provide only the top 20 tags #}
<li>
{% if tag.0 in selected_tags %}
<a
class=
"check icon-check
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span>
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
</div>
<!-- .search-filters -->
{% endblock %}
...
...
panikweb_templates/templates/news/archives.html
View file @
3ef012f9
...
...
@@ -3,19 +3,18 @@
{% load paniktags %}
{% block title %}Actus - Archives{% endblock %}
{% block nav %}
{% news_nav with klass="archives" %}
<div
class=
"search-filters"
>
{% if facets.fields.news_categories %}
<nav>
<ul
class=
"custom padded"
>
<li><span
class=
"mainLabel"
>
Catégorie :
</span></li>
{% for category in facets.fields.news_categories %}
<li>
{% if category.0 in selected_news_categories %}
<a
class=
"check icon-check
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|remove_news_category_facet:category.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_news_category_facet:category.0 }}"
>
{{ category.0 }}
<span
class=
"smooth"
>
| {{ category.1 }}
</span>
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|append_news_category_facet:category.0 }}"
>
{{ category.0 }}
<span
class=
"smooth"
>
| {{ category.1 }}
</span></a>
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_news_category_facet:category.0 }}"
>
{{ category.0 }}
<span
class=
"smooth"
>
| {{ category.1 }}
</span></a>
{% endif %}
</li>
{% endfor %}
...
...
@@ -26,23 +25,22 @@
{% if facets.fields.tags %}
<nav>
<ul
class=
"tag-facets custom padded"
>
<li><span
class=
"mainLabel"
>
Mots
clés :
</span></li>
<li><span
class=
"mainLabel"
>
Mots
-
clés :
</span></li>
{% for tag in facets.fields.tags|slice:":20" %} {# Provide only the top 20 tags #}
<li>
{% if tag.0 in selected_tags %}
<a
class=
"check icon-check
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span>
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
</div>
{% endblock %}
{% block main %}
...
...
panikweb_templates/templates/search/search.html
View file @
3ef012f9
...
...
@@ -14,21 +14,21 @@
</div>
</div>
<div
class=
"wrapper"
>
<div
class=
"
newsF
ilters"
>
<div
class=
"
search-f
ilters"
>
{% if query or selected_tags %}
<nav
class=
""
>
{% if facets.fields.categories %}
<ul
class=
"custom padded"
>
<li><span
class=
"mainLabel"
>
Genre:
</span></li>
<li><span
class=
"mainLabel"
>
Genre
:
</span></li>
{# Provide only the top 5 categories #}
{% for category in facets.fields.categories|slice:":5" %}
<li>
{% if category.0 in selected_categories %}
<a
class=
"check icon-check
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|remove_category_facet:category.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_category_facet:category.0 }}"
>
{{ category.0 }}
<span
class=
"smooth"
>
| {{ category.1 }}
</span>
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ category.1 }}
"
href=
"{{ request.get_full_path|append_category_facet:category.0 }}"
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_category_facet:category.0 }}"
>
{{ category.0 }}
<span
class=
"smooth"
>
| {{ category.1 }}
</span></a></span>
{% endif %}
</li>
...
...
@@ -39,16 +39,16 @@
<nav>
{% if facets.fields.tags %}
<ul
class=
"tag-facets custom padded"
>
<li><span
class=
"mainLabel"
>
Mots
clés:
</span></li>
<li><span
class=
"mainLabel"
>
Mots
-
clés
:
</span></li>
{# Provide only the top 5 tags #}
{% for tag in facets.fields.tags|slice:":20" %}
<li>
{% if tag.0 in selected_tags %}
<a
class=
"check icon-check
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
<a
class=
"check icon-check"
href=
"{{ request.get_full_path|remove_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span>
</a>
{% else %}
<a
class=
"check icon-check-empty
count-{{ tag.1 }}
"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
<a
class=
"check icon-check-empty"
href=
"{{ request.get_full_path|append_tag_facet:tag.0 }}"
>
{{ tag.0 }}
<span
class=
"smooth"
>
| {{ tag.1 }}
</span></a>
{% endif %}
</li>
{% endfor %}
...
...
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