Commit 5f8fa02e authored by Simon Daron's avatar Simon Daron

Add sectionName in view

parent d94e06b7
......@@ -21,6 +21,7 @@ class EmissionDetailView(DetailView):
def get_context_data(self, **kwargs):
context = super(EmissionDetailView, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
context['schedules'] = Schedule.objects.filter(emission=self.object).order_by('datetime')
# get all episodes, with an additional attribute to get the date of
......@@ -56,6 +57,7 @@ class EpisodeDetailView(DetailView):
def get_context_data(self, **kwargs):
context = super(EpisodeDetailView, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
context['diffusions'] = Diffusion.objects.filter(episode=self.object.id)
context['soundfiles'] = SoundFile.objects.filter(episode=self.object.id)
context['emission'] = Emission.objects.get(slug=self.kwargs.get('emission_slug'))
......@@ -92,6 +94,7 @@ class ProgramView(TemplateView):
def get_context_data(self, year=None, week=None, **kwargs):
context = super(ProgramView, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
schedules = Schedule.objects.select_related().order_by('datetime')
days = []
for day in range(7):
......@@ -141,6 +144,7 @@ class Grid(TemplateView):
def get_context_data(self, **kwargs):
context = super(Grid, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
nb_lines = 2 * 24 # the cells are half hours
grid = []
......@@ -344,6 +348,7 @@ class Home(TemplateView):
def get_context_data(self, **kwargs):
context = super(Home, self).get_context_data(**kwargs)
context['sectionName'] = "home"
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')
......@@ -359,6 +364,7 @@ home = Home.as_view()
class NewsItemDetailView(DetailView):
model = NewsItem
def get_context_data(self, **kwargs):
context['sectionName'] = "news"
context = super(NewsItemDetailView, self).get_context_data(**kwargs)
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all())
......@@ -370,6 +376,7 @@ class News(TemplateView):
def get_context_data(self, **kwargs):
context = super(News, self).get_context_data(**kwargs)
context['sectionName'] = "news"
context['newsImaged'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[:3])
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all())
......@@ -382,6 +389,7 @@ class Emissions(TemplateView):
def get_context_data(self, **kwargs):
context = super(Emissions, self).get_context_data(**kwargs)
context['sectionName'] = "emissions"
context['emissions'] = Emission.objects.all().order_by('title')
context['categories'] = Category.objects.all()
return context
......@@ -390,7 +398,6 @@ emissions = Emissions.as_view()
class Get(TemplateView):
template_name = 'get.html'
def get_context_data(self, **kwargs):
context = super(Get, self).get_context_data(**kwargs)
context['emissions'] = Emission.objects.all().order_by('title')
......@@ -403,6 +410,7 @@ class Listen(TemplateView):
def get_context_data(self, **kwargs):
context = super(Listen, self).get_context_data(**kwargs)
context['sectionName'] = "listen"
context['sounds'] = SoundFile.objects.all()[:15]
listenable = []
x=0
......
......@@ -231,7 +231,8 @@ body{
background:#003446;
}
#Nav nav{padding:0.1em;}
#Nav *{ color:#ddd;border-color:#ddd;}
#Nav *{ color:#ccc;border-color:#ddd;}
#Nav .active,#Nav .active *{color:white !important;}
#Nav nav ul.columns {column-rule:2px solid #342E2E;-moz-column-rule:2px solid #342E2E;-webkit-column-rule:2px solid #342E2E;}
#Nav nav.right{
......
......@@ -29,7 +29,7 @@
{% block extrascripts %}{% endblock %}
</head>
<body id="{% block bodyID %}{% endblock %}">
<body id="{% block bodyID %}{% endblock %}" class="section-{{sectionName}}">
<div id="All">
{% block meta %}<div id="metaNav">{% metanav %}</div>{% endblock %}
<div id="Commons">
......
<nav>
<ul class="inline">
<li><a href="{% url 'emissions' %}">
<li><a href="{% url 'emissions' %}" class="{% if class != "program" or class != "grid" %}active{% endif %}">
<span class="icon-microphone" ></span>
<span class="iconLabel">Emissions</span>
</a></li>
<li><a href="{% url 'program' %}">
<li><a href="{% url 'program' %}" class="{% if class = "program" %}active{% endif %}">
<span class="icon-calendar" ></span>
<span class="iconLabel">Cette semaine</span>
</a></li>
<li><a href="{% url 'grid' %}">
<li><a href="{% url 'grid' %}" class="{% if class = "grid" %}active{% endif %}">
<span class="icon-th-large" ></span>
<span class="iconLabel">La grille</span>
</a></li>
......
......@@ -3,7 +3,7 @@
{% block bodyID %}Program{% endblock %}
{% block title %}Programme{% endblock %}
{% block nav %}
{% emission_nav with klass="week" %}
{% emission_nav with klass="program" %}
{% if week %}
<div class="program">
<nav class="center">
......
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