Commit 33127b60 authored by Simon Daron's avatar Simon Daron

News view

parent a0bc11a1
......@@ -119,6 +119,14 @@ def news_inline(content=None, klass=None, logo=None):
'logo': logo
}
@register.inclusion_tag('news/roll.html', takes_context=True)
def newsroll(context, nbr=None):
return {
'news': context.get('news'),
'focus': context.get('focus'),
'nbr': nbr,
}
@register.filter
def jsonify(object):
......
......@@ -352,7 +352,8 @@ 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')[:6])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:3])
context['news'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[3:10])
context['emissions'] = list(Emission.objects.filter(archived=False).order_by('title'))
schedules = Schedule.objects.select_related().order_by('datetime')
days = []
......@@ -369,19 +370,21 @@ class NewsItemView(DetailView):
def get_context_data(self, **kwargs):
context = super(NewsItemView, self).get_context_data(**kwargs)
context['sectionName'] = "News"
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:3])
context['news'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[3:10])
context['newsAll'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all())
return context
newsitemview = NewsItemView.as_view()
class News(TemplateView):
template_name = 'news.html'
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')[:12])
context['news'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['focus'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[0:3])
context['news'] = list(NewsItem.objects.all().exclude(image__isnull=True).exclude(image__exact='').order_by('-datetime')[3:10])
context['newsAll'] = list(NewsItem.objects.all().order_by('-datetime')[:60])
context['categories'] = list(NewsCategory.objects.all())
return context
......
......@@ -247,6 +247,9 @@ body{
box-shadow: 0px 0px 100px rgb(0, 0, 0) inset;
*/
}
#Home #Nav, #News #Nav{
background:#000;
}
#Nav form{
background-color:#333;
color: white;
......@@ -667,34 +670,38 @@ background-color:#ff6633; border-color:#fff;}
/****************************************************/
/**** Home ****/
#Home .newsRoll li{
.newsRoll li{
background:black;
color:white;
border:2px solid black !important;
}
.newsRoll .title{
}
@media (max-width: 600px){
#Home .newsRoll li.largeScreens{
.newsRoll li.largeScreens{
display:none;
}
}
#Home .newsRoll img.logo{
.newsRoll img.logo{
display:inline-block;
width:100% !important;
border:none;
margin:none;
padding:none;
}
#Home .newsRoll .absolute{
.newsRoll .absolute{
background:black;
color:white;
bottom:0px;
width:100%;
opacity:0.8;
}
#Home .newsRoll h5{
.newsRoll h5{
font-size:0.8em;
color:white;
padding:1em;
}
#Home #Nav li a {
.newsRoll li a {
margin:0 0 0 0 !important;
padding:0 0 0 0 !important;
}
......
......@@ -22,7 +22,7 @@ $(function() {
doLog('Sorry! And error occur when loading page content','error');
}
new_content = $($.parseHTML(html)).find('#Changing>*');
$main.empty().append(new_content);
$main.hide().empty().append(new_content).fadeIn();
var newTitle = html.match(/<title>(.*?)<\/title>/);
if(newTitle){document.title = newTitle[1].trim().decodeHTML();}
......
......@@ -3,7 +3,7 @@
{% load paniktags %}
{% block title %}{{ newsitem.title }}{% endblock %}
{% block nav %}
{% news_nav %}
{% news_nav %}
{% endblock %}
{% block main %}
<div class="detail padded news cf">
......@@ -12,9 +12,12 @@
{% if newsitem.datetime %}
<div class="date cf center">{{ newsitem.datetime|date:"D m/M" }}</div>
{% endif %}
<h3 class="squashed title">
{{ newsitem.title }}
</h3>
</header>
{% if newsitem.image %}
<img class="logo right" src="{{ newsitem.image|thumbnail:'640x480' }}"/>
<img class="logo right" src="{{ newsitem.image.url }}"/>
{% endif %}
<div class="userContent description">
{{ newsitem.text|safe}}
......
......@@ -5,24 +5,7 @@
{% block bodyID %}Home{% endblock %}
{% block title %}Home{% endblock %}
{% block nav %}
<div class="news">
<div class="newsRoll center wrapper">
<ul class="custom distributed">
{% for content in news %}
<li class="{% if forloop.counter > 3 %}largeScreens{% endif %}">
<a class="block news relative" href="{% url 'news-view' slug=content.slug %}">
{% if content.image %}
<div class="absolute">
<h5 class="title ellipsis">{{content.title}}</h5>
</div>
<img class="logo" src="{{ content.image|thumbnail:'320x240' }}"/>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% newsroll %}
{% endblock %}
{% block main %}
<div class="padded">
......
......@@ -58,7 +58,7 @@
else{WhatsOnAir.html('<span>Unknown (Probably Non-Stop)</span>');}
WhatsOnAir.fadeIn();
});
}).trigger('load');
});
$('#RefreshWhatsOnAir').on('activate',function(e){
$(this).addClass('spinning');
$('#WhatsOnAir').addClass('active');
......@@ -74,7 +74,7 @@
$(this).trigger('activate');
}else{$(this).trigger('deactivate');}
return false;
});
}).trigger('activate');
$("#DirectStreamPanikControler").on('click',function(e) {
e.preventDefault();
var stream = $('#DirectStreamPanik').get(0);
......
{% extends "base.html"%}
{% load paniktags %}
{% block title %}News{% endblock %}
{% block nav %}
{% news_nav %}
{% endblock %}
{% block main %}
<div class="news">
<div class="wrapper">
<ul class="custom columns list news cf">
{% for NewsItem in newsImaged %}
{% for NewsItem in news %}
<li class="item">
{% news_inline content=NewsItem klass="special inBlock padded" logo="medium"%}
</li>
......@@ -18,7 +21,7 @@
<div class="wrapper">
<div class="padded ">
<ul class="news columns padded list custom">
{% for NewsItem in news %}
{% for NewsItem in newsAll %}
<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>
......
<nav>
<ul class="inline">
<li>
<a href="{% url 'news' %}">
<span class="icon-bullhorn" ></span>
<span class="iconLabel">News</span>
</a>
</li>
</ul>
</nav>
{% if newsitem %}
<div class="wrapper text">
<header class="mainHeader">
<h3 class="squashed title">
{{ newsitem.title }}
</h3>
</header>
</div>
{% endif %}
{% load paniktags %}
{% newsroll %}
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