Commit 6b9779d1 authored by Simon Daron's avatar Simon Daron

Import newsitem in panikweb

parent 2144f89b
......@@ -20,7 +20,7 @@ urlpatterns = patterns('',
url(r'^get$', 'panikweb.views.get', name='get'),
url(r'^listen$', 'panikweb.views.listen', name='listen'),
url(r'^news/$', 'panikweb.views.news', name='news'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitem', name='news-view'),
url(r'^news/(?P<slug>[\w,-]+)$', 'panikweb.views.newsitem', name='newsitem'),
url(r'^search/', 'panikweb.search.view', name='search'),
......
......@@ -15,6 +15,7 @@ from emissions.models import Category, Emission, Episode, Diffusion, SoundFile,
from emissions.utils import whatsonair, period_program
class EmissionDetailView(DetailView):
model = Emission
......@@ -317,9 +318,7 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['newsImaged'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[:3])
context['newsImaged2'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[3:15])
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:36])
context['news'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[:10])
context['emissions'] = list(Emission.objects.filter(archived=False).order_by('title'))
schedules = Schedule.objects.select_related().order_by('datetime')
days = []
......@@ -331,6 +330,15 @@ class Home(TemplateView):
home = Home.as_view()
class NewsItemDetailView(DetailView):
model = NewsItem
def get_context_data(self, **kwargs):
context = super(NewsItemDetailView, self).get_context_data(**kwargs)
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all())
return context
newsitem = NewsItemDetailView.as_view()
class News(TemplateView):
template_name = 'news.html'
......
......@@ -557,12 +557,12 @@ body{
/**** COLOR VARIANTS ****/
/*
#News #Nav,
#News #Nav *,
.news,
.news *
{color:white;background-color:#4682B4; border-color:#fff !important;color:#fff !important;}
/*
#News, #news,.news, .news *,.mainLegend.news {
background-color:#fff;
border-color:#1663d5 !important;
......
......@@ -20,7 +20,8 @@ $(function() {
}
new_content = $($.parseHTML(html)).find('#Changing>*');
$main.empty().append(new_content);
document.title = html.match(/<title>(.*?)<\/title>/)[1].trim().decodeHTML();
var newTitle = html.match(/<title>(.*?)<\/title>/);
if(newTitle){document.title = newTitle[1].trim().decodeHTML();}
/*
Quite UGLY but needed for styling the whole body with ID
Feel free to correct and find a better way
......
......@@ -2,73 +2,42 @@
{% load thumbnails %}
{% load paniktags %}
{% block bodyID %}Home{% endblock %}
{% block nav %}{% endblock %}
{% block title %}{% endblock %}
{% block title %}Home{% endblock %}
{% block nav %}
<div class="news">
<div class="wrapper newsRoll">
<h2>News</h2>
<ul class="custom inline ellipsis center">
{% for content in news %}
<li class="item">
<a class="inBlock news" href="{% url 'news-view' slug=content.slug %}">
{% if content.image %}
<img class="logo" src="{{ content.image|thumbnail:'100x100' }}"/>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% block main %}
{% if program %}dfsdfsdf
{{ program }}
{% endif %}
<div class="news">
<div class="wrapper">
<ul class="custom list news cf">
{% for NewsItem in newsImaged %}
<li class="item num-{{forloop.counter}}">
{% if NewsItem.slug == newsImaged.0.slug %}
{% news_inline content=NewsItem klass="special" logo="large" %}
{% elif NewsItem.slug == newsImaged.1.slug or NewsItem.slug == newsImaged.2.slug%}
{% news_inline content=NewsItem klass="special" logo="medium" %}
{% else %}
{% endif %}
</li>
{% endfor %}
</ul>
<div class="padded">
<div class="wrapper">
<h2>Cette semaine sur Panik</h2>
{% weekview %}
</div>
</div>
<hr />
<div class="wrapper padded news newsRoll">
<ul class="custom inline ellipsis center">
{% for content in newsImaged2 %}
{% endblock %}
{% block links %}
<div class="wrapper padded">
<h2>Emissions</h2>
<ul class="custom list columns padded">
{% for emission in emissions %}
<li class="item">
<a class="inBlock news" href="{% url 'news-view' slug=content.slug %}">
{% if content.image %}
<img class="logo" src="{{ content.image|thumbnail:'100x100' }}"/>
{% endif %}
</a>
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
</li>
{% endfor %}
</ul>
</div>
<hr />
<div class="wrapper">
<ul class="news columns padded">
{% for NewsItem in news %}
<li class="item ellipsis small ">
<a href="{% url 'news-view' slug=NewsItem.slug %}">
<span class="title"><strong>{{ NewsItem.datetime|date:"D m/M" }}</strong>&nbsp;-&nbsp;{{ NewsItem.title }}</span>
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="padded">
<div class="wrapper">
<h2>Cette semaine sur Panik</h2>
{% weekview %}
</div>
</div>
{% endblock %}
{% block links %}
<div class="wrapper padded">
<h2>Emissions</h2>
<ul class="custom list columns padded">
{% for emission in emissions %}
<li class="item">
<a href="{% url 'emission-view' slug=emission.slug %}">{{ emission.title }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
......@@ -20,6 +20,9 @@
</ul>
</div>
<hr />
</div>
{% endblock %}
{% block links %}
<div class="wrapper">
<ul class="news columns padded">
{% for NewsItem in news %}
......@@ -31,5 +34,4 @@
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
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