work on home page, fix views & templates issues

This commit is contained in:
bkfox
2019-09-10 17:57:24 +02:00
parent 215a6ac331
commit e30d1b54ef
51 changed files with 658 additions and 276 deletions

View File

@ -0,0 +1,11 @@
{% comment %}
Context:
- object: diffusion
- "episode_item"'s context (except object and diffusion)
{% endcomment %}
{% with object as diffusion %}
{% with object.episode as object %}
{% include "aircox/widgets/episode_item.html" %}
{% endwith %}
{% endwith %}

View File

@ -0,0 +1,39 @@
{% extends "aircox/widgets/page_item.html" %}
{% load i18n easy_thumbnails_tags aircox %}
{% comment %}
Context variables:
- object: episode
- diffusion: episode's diffusion
- hide_schedule: if True, do not display start time
{% endcomment %}
{% block title %}
{% if not object.is_published and object.program.is_published %}
<a href="{{ object.program.get_absolute_url }}">{{ object.title }}</a>
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block subtitle %}
{{ block.super }}
{% if diffusion %}
{% if not hide_schedule %}
{% if object.category %}&mdash;{% endif %}
<time datetime="{{ diffusion.start|date:"c" }}" title="{{ diffusion.start }}">
{{ diffusion.start|date:"d M, H:i" }}
</time>
{% endif %}
{% if diffusion.initial %}
{% with diffusion.initial.date as date %}
<span title="{% blocktrans %}Rerun of {{ date }}{% endblocktrans %}">
{% trans "(rerun)" %}
</span>
{% endwith %}
{% endif %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,21 @@
{% load i18n aircox %}
{% comment %}
Context objects:
- object: object to render
- hide_schedule: if true, hide the schedule
In case of modification, you might want to check on `assets/vue/player.vue`
for design review.
{% endcomment %}
{% if object|is_diffusion %}
{% with object as diffusion %}
{% include "aircox/widgets/diffusion_item.html" %}
{% endwith %}
{% else %}
{% with object.track as object %}
{% include "aircox/widgets/track_item.html" %}
{% endwith %}
{% endif %}

View File

@ -0,0 +1,29 @@
{% comment %}
Render list of logs (as widget).
Context:
- object_list: list of logs to display
{% endcomment %}
{% load aircox %}
{% with True as hide_schedule %}
<table class="table is-striped is-hoverable is-fullwidth" role="list">
{% for object in object_list %}
<tr>
<td>
{% if object|is_diffusion %}
<time datetime="{{ object.start }}" title="{{ object.start }}">
{{ object.start|date:"H:i" }} - {{ object.end|date:"H:i" }}
</time>
{% else %}
<time datetime="{{ object.date }}" title="{{ object.date }}">
{{ object.date|date:"H:i" }}
</time>
{% endif %}
</td>
<td>{% include "aircox/widgets/log_item.html" %}</td>
</tr>
{% endfor %}
</table>
{% endwith %}

View File

@ -0,0 +1,60 @@
{% load i18n easy_thumbnails_tags aircox %}
{% comment %}
Context variables:
- object: the object to render
- render_card: render as card
- is-primary: render as primary
- has_headline (=False): if True, display headline
- has_cover (=True): hide page cover
{% endcomment %}
{% if render_card %}
<article class="card {% if is_primary %}is-primary{% endif %}">
<header class="card-image">
<figure class="image is-4by3">
<img src="{% thumbnail object.cover 480x480 %}">
</figure>
</header>
<div class="card-header">
<h4 class="title">
<a href="{{ object.get_absolute_url }}">{{ object.title }}</a>
</h4>
</div>
</article>
{% else %}
<article class="media item {% if is_primary %}is-primary{% endif %}">
{% if has_cover|default_if_none:True %}
<div class="media-left">
<img src="{% thumbnail object.cover 128x128 crop=scale %}"
class="small-cover">
</div>
{% endif %}
<div class="media-content">
<h5 class="title is-5 has-text-weight-normal">
{% block title %}
{% if object.is_published %}
<a href="{{ object.get_absolute_url }}">{{ object.title }}</a>
{% else %}
{{ object.title }}
{% endif %}
{% endblock %}
</h5>
<div class="subtitle is-6 has-text-weight-light">
{% block subtitle %}
{% if object.category %}{{ object.category.title }}{% endif %}
{% endblock %}
</div>
{% if has_headline|default_if_none:True %}
<div class="headline">
{% block headline %}
{{ object.headline|safe }}
{% endblock %}
</div>
{% endif %}
</div>
</article>
{% endif %}

View File

@ -0,0 +1,28 @@
{% comment %}
Display list of items as small list
Context:
- object_list: object list
- list_url: url to complete list page
{% endcomment %}
{% load i18n %}
{% for object in object_list %}
{% include object.item_template_name %}
{% endfor %}
{% if list_url %}
<br>
<nav class="pagination is-centered">
<ul class="pagination-list">
<li>
<a href="{{ list_url }}" class="pagination-link"
aria-label="{% trans "Show all publications" %}">
{% trans "Show more" %}
</a>
</li>
</ul>
</nav>
{% endif %}

View File

@ -0,0 +1,8 @@
<div class="podcast">
{% if object.embed %}
{{ object.embed|safe }}
{% else %}
<audio src="{{ object.url }}" controls>
{% endif %}
</div>

View File

@ -0,0 +1,12 @@
{% comment %}
Context:
- object: track to render
{% endcomment %}
<span class="has-text-info is-size-5">&#9836;</span>
<span>{{ object.title }}</span>
<span class="has-text-grey-dark has-text-weight-light">
&mdash; {{ object.artist }}
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
</span>