Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikweb
Commits
f204be4e
Commit
f204be4e
authored
Sep 16, 2013
by
fred
Browse files
display tags in episode view
parent
5dc43c16
Changes
3
Hide whitespace changes
Inline
Side-by-side
panikweb/search.py
View file @
f204be4e
...
...
@@ -116,6 +116,20 @@ from haystack.views import search_view_factory, FacetedSearchView
from
haystack.forms
import
FacetedSearchForm
,
SearchForm
class
GlobalSearchForm
(
FacetedSearchForm
):
def
no_query_found
(
self
):
sqs
=
super
(
GlobalSearchForm
,
self
).
no_query_found
()
if
self
.
selected_facets
:
sqs
=
self
.
searchqueryset
.
all
()
for
facet
in
self
.
selected_facets
:
if
":"
not
in
facet
:
continue
field
,
value
=
facet
.
split
(
":"
,
1
)
if
value
:
sqs
=
sqs
.
narrow
(
u
'%s:"%s"'
%
(
field
,
sqs
.
query
.
clean
(
value
)))
return
sqs
class
SearchView
(
FacetedSearchView
):
def
extra_context
(
self
):
context
=
super
(
SearchView
,
self
).
extra_context
()
...
...
@@ -131,7 +145,7 @@ class SearchView(FacetedSearchView):
sqs
=
SearchQuerySet
().
models
(
Emission
,
Episode
,
NewsItem
).
facet
(
'categories'
).
facet
(
'tags'
)
view
=
search_view_factory
(
SearchView
,
form_class
=
Faceted
SearchForm
,
form_class
=
Global
SearchForm
,
searchqueryset
=
sqs
)
...
...
panikweb_templates/templates/episodes/detail.html
View file @
f204be4e
...
...
@@ -41,10 +41,10 @@
{% if episode.redif %}
<dt>
Redifusion
</dt><dd>
{{ redif }}
</dd>
{% endif %}
</dl>
{% endif %}
{% if episode.tag
List
%}
{% if episode.tag
s.all
%}
<ul
class=
"custom inline"
>
{% for tag in episode.tag
List
%}
<li><
button
class=
"tag"
>
{{ tag }}
</
button
></li>
{% for tag in episode.tag
s.all
%}
<li><
a
class=
"tag"
href=
"{% url 'search' %}?&selected_facets=tags_exact:{{tag.slug}}"
>
{{ tag }}
</
a
></li>
{% endfor %}
</ul>
{% endif %}
...
...
panikweb_templates/templates/search/search.html
View file @
f204be4e
...
...
@@ -8,7 +8,7 @@
<form
method=
"get"
action=
"."
class=
"big center"
id=
"search-form"
>
{{ form.as_table }}
<button
class=
"icon-search"
></button>
</form>
{% if query %}
{% if query
or selected_tags
%}
<nav>
{% if facets.fields.categories %}
<ul
class=
"custom padded"
>
...
...
@@ -52,7 +52,7 @@
{% block main %}
{% if query %}
{% if query
or selected_tags
%}
<div
class=
"wrapper"
>
<div
class=
"marged"
>
{% if not page.object_list %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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