Commit 0aa2e93d authored by fred's avatar fred

turn 'sounds' homepage like the 'news' homepage

parent ba8f7d93
......@@ -19,7 +19,8 @@ urlpatterns = patterns('',
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^emissions/archives$', 'panikweb.views.emissionsArchives', name='emissionsArchives'),
url(r'^listen/$', 'panikweb.search.listenArchives', name='listen'),
url(r'^sounds/$', 'panikweb.views.listen', name='listen'),
url(r'^sounds/archives/$', 'panikweb.search.listenArchives', name='listenArchives'),
url(r'^news/$', 'panikweb.views.news', name='news'),
url(r'^news/archives/$', 'panikweb.search.newsArchives', name='newsArchives'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitemview', name='newsitem-view'),
......
......@@ -441,7 +441,7 @@ class News(TemplateView):
def get_context_data(self, **kwargs):
context = super(News, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['focus'] = NewsItem.objects.filter(got_focus__isnull=False).select_related('category').order_by('-date')[0:9]
context['focus'] = NewsItem.objects.filter(got_focus__isnull=False).select_related('category').order_by('-date')[:10]
context['news'] = NewsItem.objects.all().order_by('-date')
return context
......@@ -478,8 +478,8 @@ class Listen(TemplateView):
def get_context_data(self, **kwargs):
context = super(Listen, self).get_context_data(**kwargs)
context['sectionName'] = "Listen"
context['soundfiles'] = SoundFile.objects.prefetch_related('episode__emission__categories').filter(
podcastable=True, fragment=False) \
context['focus'] = SoundFile.objects.prefetch_related('episode__emission__categories').filter(
podcastable=True, got_focus__isnull=False) \
.select_related().extra(select={
'first_diffusion': 'emissions_diffusion.datetime', },
select_params=(False, True),
......@@ -487,8 +487,16 @@ class Listen(TemplateView):
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''],
tables=['emissions_diffusion'],).order_by('-first_diffusion').distinct() [:10]
context['soundfiles'] = SoundFile.objects.prefetch_related('episode__emission__categories').filter(
podcastable=True) \
.select_related().extra(select={
'first_diffusion': 'emissions_diffusion.datetime', },
select_params=(False, True),
where=['''datetime = (SELECT MIN(datetime)
FROM emissions_diffusion
WHERE episode_id = emissions_episode.id)'''],
tables=['emissions_diffusion'],).order_by('-creation_timestamp').distinct() [:10]
context['categories'] = Category.objects.all()
return context
......
......@@ -384,6 +384,7 @@ body{
#Related .wrapper,
#Main > .wrapper,
#Main > .soundfiles > .wrapper,
#Main > .news > .wrapper,
#Nav > .wrapper {
padding-left: 0;
......@@ -980,6 +981,7 @@ ul.extra-soundfiles li div.audio {
border:2px solid #0000ff;
}
.soundfiles .special a,
.news .special a {
position: relative;
}
......@@ -1002,9 +1004,12 @@ ul.extra-soundfiles li div.audio {
/****************************************************/
.list.news li {
}
.soundfiles ul.custom li a,
.news ul.custom li a { -webkit-backface-visibility: hidden; }
.news li.item a{padding:1em;}
.news li.item a {padding:1em;}
.soundfiles .logo img,
.news .logo img{
display:block;
border-style:solid;
......@@ -1017,6 +1022,7 @@ ul.newsSpecial{
.columns {column-count: 1; -webkit-column-count: 1; -moz-column-count: 1;}
}
/****************************************************/
/**** Home & ****/
/****************************************************/
......
{% extends "base.html" %}
{% load paniktags %}
{% load paniktags staticfiles thumbnails %}
{% block title %}Sons{% endblock %}
{% block toptitle %}
<h1 class="top">Sons</h1>
<h1 class="top"><a href="{% url 'listen' %}">Sons</a></h1>
{% endblock %}
{% block nav %}
{% listen_nav %}
{% endblock %}
{% block main %}
<div class="">
<div class="wrapper">
<ul class="padded custom list">
{% for soundfile in soundfiles %}
<li class="item {% for category in soundfile.episode.emission.categories.all %} {{ category|slugify }}{% endfor %}">
{% soundfile_resume soundfile=soundfile date=soundfile.first_diffusion %}
</li>
{% endfor %}
</ul>
</div>
<p class="intro">
Lorem ipsum dolor sit amet, amet legendos inciderint no est. Te audiam feugiat
cum. Qui summo repudiandae eu, his et oporteat evertitur moderatius. Cum putant
ancillae legendos cu. Elit omittantur voluptatibus ad eos. Mei ei sonet
principes torquatos, vix ne essent partiendo.
o
</p>
<div class="detail marged soundfiles cf">
<div class="wrapper navigation">
<div class="leftPart">
<div class="soundfiles">
<h5 class="sectionLabel">Focus</h5>
<ul class="custom columns cf padded">
{% for soundfile in focus %}
<li class="soundfile frontpage">
<div class="content content-inline cf special">
<a class="block cf" href="{% url 'episode-view' emission_slug=soundfile.episode.emission.slug slug=soundfile.episode.slug %}">
<div class="label labels absolute">
<span class="item inBlock">{{ soundfile.format.title }}</span>
</div>
<div class="logo">
{% if soundfile.episode.image %}
<img class="normal" src="{{ soundfile.episode.image|thumbnail:'480x320' }}"/>
{% elif soundfile.episode.emission.image %}
<img class="normal" src="{{ soundfile.episode.emission.image|thumbnail:'480x320' }}"/>
{% else %}
<img class="normal" src="{% static "img/sound.png" %}"/>
{% endif %}
</div>
<div class="content">
{% if soundfile.fragment and soundfile.title %}
<h5 class="title">{{ soundfile.title }}</h5>
{% endif %}
<h5 class="title">{{ soundfile.episode.title }}</h5>
<h5 class="title">{{ soundfile.episode.emission.title }}</h5>
<div class="description">
{{ soundfile.episode.text|safe|striptags|truncatewords:75}}
</div>
{% if soundfile.first_diffusion %}
<div class="smooth">{{ soundfile.first_diffusion|date:"d/m/Y" }}</div>
{% endif %}
</div>
</a>
{% audio sound=soundfile %}
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="rightPart">
<div class="sub">
<h5 class="sectionLabel right">
<a href="{% url 'listenArchives' %}"><span class="iconLabel">Tous</span></a>
</h5>
<h5 class="sectionLabel">Derniers sons&nbsp;<a
class="button icon-rss inBlock" href="{% url 'podcasts-feed' %}"></a></h5>
<form action="{% url 'listenArchives' %}" id="search-form">
<input id="id_q" name="q" type="text" {% if search_query %}value="{{ search_query }}"{% endif %}>
<button class="icon-search"></button>
</form>
<ul class="custom list soundfilesList">
{% for soundfile in soundfiles|slice:":20" %}
<li class="item">
{% soundfile_resume soundfile=soundfile date=soundfile.first_diffusion %}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endblock %}
......@@ -2,15 +2,6 @@
{% load paniktags %}
{% block title %}Sons - Archives{% endblock %}
{% block nav %}
<p class="intro">
Ut numquam adipiscing sea, pro ne definiebas mediocritatem. Sed ut justo
semper, eam ea admodum albucius suscipiantur, eu eam omnesque suavitate. Nec te
iriure iudicabit. Ut nec deleniti tractatos. Ea postea suavitate voluptaria
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>
......
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