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

Add sectionName in view

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