Commit 88b67a55 authored by fred's avatar fred

backlinking topiks

parent 5f7b6856
......@@ -86,6 +86,7 @@ def episode_detail(context, date=None):
'diffusions': context.get('diffusions'),
'soundfiles': soundfiles,
'date': date,
'topiks': context.get('topiks'),
}
@register.inclusion_tag('emissions/detail.html', takes_context=True)
......@@ -307,6 +308,9 @@ def related_objects(object):
sqs = search.MoreLikeThisSearchQuerySet().models(Emission, Episode, NewsItem)
return {'more_like_this': sqs.more_like_this(object)[:12]}
@register.inclusion_tag('includes/topik.html', takes_context=True)
def topik(context, topik):
return {'topik': topik}
@register.filter
def get_focus_url(object):
......
......@@ -32,6 +32,8 @@ from emissions.utils import whatsonair, period_program
from newsletter.forms import SubscribeForm
from nonstop.utils import get_current_nonstop_track
from panikombo.models import ItemTopik
from . import utils
......@@ -120,6 +122,7 @@ class EpisodeDetailView(DetailView, EmissionMixin):
if self.kwargs.get('emission_slug') != context['emission'].slug:
raise Http404()
context.update(self.get_emission_context(context['emission']))
context['topiks'] = [x.topik for x in ItemTopik.objects.filter(episode=self.object)]
return context
episode = EpisodeDetailView.as_view()
......@@ -454,6 +457,7 @@ class NewsItemView(DetailView):
context['sectionName'] = "News"
context['categories'] = NewsCategory.objects.all()
context['news'] = NewsItem.objects.all().order_by('-date')
context['topiks'] = [x.topik for x in ItemTopik.objects.filter(newsitem=self.object)]
return context
newsitemview = NewsItemView.as_view()
......
......@@ -874,6 +874,7 @@ h1.top#frequence {
.episode.resume .logo{
float: right;
}
.topik.inline .logo,
.episode.inline .logo {
min-height: 50px;
float: left;
......@@ -1619,3 +1620,13 @@ div.gallery div.first img {
top: 50%;
left: 50%;
}
ul.tags {
padding-top: 1em;
clear: both;
}
div.topik.inline {
clear: both;
margin-top: 1em;
}
......@@ -36,8 +36,14 @@
{{ newsitem.text|safe}}
</div>
{% block topik %}
{% for topik in topiks %}
{% topik topik=topik %}
{% endfor %}
{% endblock %}
{% if newsitem.tags.all %}
<ul class="custom inline">
<ul class="custom inline tags">
{% for tag in newsitem.tags.all %}
<li><a class="tag" href="{% url 'search' %}?&selected_facets=tags_exact:{{tag|facet_tag}}">{{ tag }}</a></li>
{% endfor %}
......
......@@ -54,6 +54,13 @@
{{ episode.text|safe}}
</article>
{% endif %}
</div>
{% block topik %}
{% for topik in topiks %}
{% topik topik=topik %}
{% endfor %}
{% endblock %}
<div class="metas">
{% if episode.serie or episode.auteur or episode.redif %}
<dl class="credits cf">
......@@ -63,7 +70,7 @@
</dl>
{% endif %}
{% if episode.tags.all %}
<ul class="custom inline">
<ul class="custom inline tags">
{% for tag in episode.tags.all %}
<li><a class="tag" href="{% url 'search' %}?&selected_facets=tags_exact:{{tag|facet_tag}}">{{ tag }}</a></li>
{% endfor %}
......
{% load thumbnail paniktags staticfiles %}
<a href="{{ topik.page.get_online_url }}">
<div class="topik inline">
<div class="logo">
{% thumbnail topik.image "60x60" crop="50% 25%" as im %}
<img src="{{im.url}}"/>
{% endthumbnail %}
</div>
<div class="content">
<div class="title">
<h5 class="title">{{ topik.page.title }}</h5>
</div>
<div class="description ellipsis">
</div>
</div>
</div>
</a>
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