update home page + sidebar items sizing
This commit is contained in:
parent
a4593dc0c5
commit
ffd5b5b013
|
@ -10883,9 +10883,6 @@ main .cover.is-tiny {
|
||||||
aside > section {
|
aside > section {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
aside .cover {
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
aside .cover.is-small {
|
aside .cover.is-small {
|
||||||
width: 10em;
|
width: 10em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,10 +132,11 @@ Usefull context:
|
||||||
{# FIXME: block cover into sidebar one #}
|
{# FIXME: block cover into sidebar one #}
|
||||||
{% block cover %}
|
{% block cover %}
|
||||||
{% if page and page.cover %}
|
{% if page and page.cover %}
|
||||||
<img class="cover" src="{{ page.cover.url }}" class="cover"/>
|
<img class="cover mb-4" src="{{ page.cover.url }}" class="cover"/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% with is_thin=True %}
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{% if sidebar_object_list %}
|
{% if sidebar_object_list %}
|
||||||
{% with object_list=sidebar_object_list %}
|
{% with object_list=sidebar_object_list %}
|
||||||
|
@ -152,6 +153,7 @@ Usefull context:
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% endwith %}
|
||||||
</aside>
|
</aside>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,22 +23,7 @@
|
||||||
{% block pages_list %}
|
{% block pages_list %}
|
||||||
{% with hide_schedule=True %}
|
{% with hide_schedule=True %}
|
||||||
<section role="list">
|
<section role="list">
|
||||||
<div id="timetable-{{ date|date:"Y-m-d" }}">
|
{% include 'aircox/widgets/diffusion_list.html' %}
|
||||||
{% for diffusion in object_list %}
|
|
||||||
<div class="columns {% if diffusion.is_now %}has-background-primary{% endif %}">
|
|
||||||
<div class="column is-one-fifth has-text-right">
|
|
||||||
<time datetime="{{ diffusion.start|date:"c" }}">
|
|
||||||
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
|
|
||||||
</time>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
{% with diffusion.episode as object %}
|
|
||||||
{% include "aircox/widgets/episode_item.html" %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
{% block pages_list %}
|
{% block pages_list %}
|
||||||
{% if page and page.content %}<hr/>{% endif %}
|
{% if page and page.content %}<hr/>{% endif %}
|
||||||
{% if top_diffs %}
|
{% if next_diffs %}
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
{% with render_card=True %}
|
{% with render_card=True %}
|
||||||
{% for object in top_diffs %}
|
{% for object in next_diffs %}
|
||||||
{% with is_primary=object.is_now %}
|
{% with is_primary=object.is_now %}
|
||||||
<div class="column is-relative">
|
<div class="column is-relative">
|
||||||
<h4 class="card-super-title" title="{{ object.start }}">
|
<h4 class="card-super-title" title="{{ object.start }}">
|
||||||
|
@ -40,16 +40,16 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h4 class="title is-4">{% translate "Last publications" %}</h4>
|
{% if object_list %}
|
||||||
{% with has_headline=True %}
|
<h4 class="title is-4">{% translate "Today" %}</h4>
|
||||||
{{ block.super }}
|
<section role="list">
|
||||||
{% endwith %}
|
{% include 'aircox/widgets/diffusion_list.html' %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block pagination %}
|
{% block pagination %}
|
||||||
<ul class="pagination-list">
|
<ul class="pagination-list">
|
||||||
<li>
|
<li>
|
||||||
|
@ -65,25 +65,20 @@
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
<section>
|
<section>
|
||||||
<h4 class="title is-4">{% translate "Previously on air" %}</h4>
|
<h4 class="title is-4">{% translate "Previously on air" %}</h4>
|
||||||
|
{% with has_cover=False %}
|
||||||
{% with logs as object_list %}
|
{% with logs as object_list %}
|
||||||
{% include "aircox/widgets/log_list.html" %}
|
{% include "aircox/widgets/log_list.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h4 class="title is-4">{% translate "Today" %}</h4>
|
<h4 class="title is-4">{% translate "Last publications" %}</h4>
|
||||||
{% with is_thin=True %}
|
|
||||||
{% with hide_schedule=True %}
|
{% with hide_schedule=True %}
|
||||||
{% with has_headline=False %}
|
{% with has_headline=False %}
|
||||||
<table class="table is-fullwidth has-background-transparent">
|
{% for object in last_publications %}
|
||||||
{% for object in sidebar_object_list %}
|
{% include object.item_template_name|default:'aircox/widgets/page_item.html' %}
|
||||||
<tr {% if object.is_now %}class="is-selected"{% endif %}>
|
|
||||||
<td>{{ object.start|date:"H:i" }}</td>
|
|
||||||
<td>{% include "aircox/widgets/diffusion_item.html" %}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -8,6 +8,7 @@ Context variables:
|
||||||
- is-primary: render as primary
|
- is-primary: render as primary
|
||||||
- has_headline (=False): if True, display headline
|
- has_headline (=False): if True, display headline
|
||||||
- has_cover (=True): hide page cover
|
- has_cover (=True): hide page cover
|
||||||
|
- is_thin (=False): if True, smaller cover and display less info
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% if render_card %}
|
{% if render_card %}
|
||||||
|
@ -31,8 +32,13 @@ Context variables:
|
||||||
<article class="media item {% block css %}{% endblock%}">
|
<article class="media item {% block css %}{% endblock%}">
|
||||||
{% if has_cover|default_if_none:True %}
|
{% if has_cover|default_if_none:True %}
|
||||||
<div class="media-left">
|
<div class="media-left">
|
||||||
|
{% if is_thin %}
|
||||||
|
<img src="{% thumbnail object.cover|default:station.default_cover 64x64 crop=scale %}"
|
||||||
|
class="cover is-tiny">
|
||||||
|
{% else %}
|
||||||
<img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
|
<img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
|
||||||
class="cover is-small">
|
class="cover is-small">
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
|
|
22
aircox/templates/aircox/widgets/diffusion_list.html
Normal file
22
aircox/templates/aircox/widgets/diffusion_list.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% comment %}
|
||||||
|
Context:
|
||||||
|
- object_list: object list
|
||||||
|
- date: date for list
|
||||||
|
{% endcomment %}
|
||||||
|
<table id="timetable{% if date %}-{{ date|date:"Y-m-d" }}{% endif %}" style="border:none;">
|
||||||
|
{% for diffusion in object_list %}
|
||||||
|
<tr class="{% if diffusion.is_now %}has-background-primary{% endif %}">
|
||||||
|
<td class="pr-2 pb-2">
|
||||||
|
<time datetime="{{ diffusion.start|date:"c" }}">
|
||||||
|
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
|
||||||
|
</time>
|
||||||
|
</td>
|
||||||
|
<td class="pb-2">
|
||||||
|
{% with diffusion.episode as object %}
|
||||||
|
{% include "aircox/widgets/episode_item.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
|
|
@ -1,33 +1,32 @@
|
||||||
import datetime
|
from datetime import date
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.utils import timezone as tz
|
from django.utils import timezone as tz
|
||||||
|
from django.views.generic import ListView
|
||||||
|
|
||||||
from ..models import Diffusion, Log, Page, StaticPage
|
from ..models import Diffusion, Log, Page, StaticPage
|
||||||
|
from .base import BaseView
|
||||||
from .page import PageListView
|
from .page import PageListView
|
||||||
|
|
||||||
|
|
||||||
class HomeView(PageListView):
|
class HomeView(BaseView, ListView):
|
||||||
template_name = 'aircox/home.html'
|
template_name = 'aircox/home.html'
|
||||||
model = Page
|
model = Diffusion
|
||||||
queryset = Page.objects.select_subclasses()
|
attach_to_value = StaticPage.ATTACH_TO_HOME
|
||||||
paginate_by = 10
|
queryset = Diffusion.objects.on_air().select_related('episode')
|
||||||
list_count = 40
|
|
||||||
logs_count = 5
|
logs_count = 5
|
||||||
has_filters = False
|
has_filters = False
|
||||||
attach_to_value = StaticPage.ATTACH_TO_HOME
|
|
||||||
|
|
||||||
def get_logs(self):
|
def get_queryset(self):
|
||||||
today = datetime.date.today()
|
return super().get_queryset().date(date.today())
|
||||||
|
|
||||||
|
def get_logs(self, diffusions):
|
||||||
|
today = date.today()
|
||||||
logs = Log.objects.on_air().date(today).filter(track__isnull=False)
|
logs = Log.objects.on_air().date(today).filter(track__isnull=False)
|
||||||
diffs = Diffusion.objects.on_air().date(today)
|
# diffs = Diffusion.objects.on_air().date(today)
|
||||||
return Log.merge_diffusions(logs, diffs, self.logs_count)
|
return Log.merge_diffusions(logs, diffusions, self.logs_count)
|
||||||
|
|
||||||
def get_sidebar_queryset(self):
|
def get_next_diffs(self):
|
||||||
today = datetime.date.today()
|
|
||||||
return Diffusion.objects.on_air().date(today)
|
|
||||||
|
|
||||||
def get_top_diffs(self):
|
|
||||||
now = tz.now()
|
now = tz.now()
|
||||||
current_diff = Diffusion.objects.on_air().now(now).first()
|
current_diff = Diffusion.objects.on_air().now(now).first()
|
||||||
next_diffs = Diffusion.objects.on_air().after(now)
|
next_diffs = Diffusion.objects.on_air().after(now)
|
||||||
|
@ -37,10 +36,14 @@ class HomeView(PageListView):
|
||||||
diffs = next_diffs[:3]
|
diffs = next_diffs[:3]
|
||||||
return diffs
|
return diffs
|
||||||
|
|
||||||
|
def get_last_publications(self):
|
||||||
|
return Page.objects.select_subclasses().published() \
|
||||||
|
.order_by('-pub_date')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs['logs'] = self.get_logs()
|
context = super().get_context_data(**kwargs)
|
||||||
kwargs['top_diffs'] = self.get_top_diffs()
|
context['logs'] = self.get_logs(context['object_list'])
|
||||||
return super().get_context_data(**kwargs)
|
context['next_diffs'] = self.get_next_diffs()
|
||||||
|
context['last_publications'] = self.get_last_publications()[:5]
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
|
@ -268,10 +268,6 @@ aside {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover {
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cover.is-small { width: 10em; }
|
.cover.is-small { width: 10em; }
|
||||||
.cover.is-tiny { height: 2em; }
|
.cover.is-tiny { height: 2em; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user