forked from rc/aircox
work on home page, fix views & templates issues
This commit is contained in:
11
aircox/templates/aircox/widgets/diffusion_item.html
Normal file
11
aircox/templates/aircox/widgets/diffusion_item.html
Normal 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 %}
|
||||
|
39
aircox/templates/aircox/widgets/episode_item.html
Normal file
39
aircox/templates/aircox/widgets/episode_item.html
Normal 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 %}—{% 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 %}
|
||||
|
21
aircox/templates/aircox/widgets/log_item.html
Normal file
21
aircox/templates/aircox/widgets/log_item.html
Normal 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 %}
|
||||
|
29
aircox/templates/aircox/widgets/log_list.html
Normal file
29
aircox/templates/aircox/widgets/log_list.html
Normal 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 %}
|
||||
|
60
aircox/templates/aircox/widgets/page_item.html
Normal file
60
aircox/templates/aircox/widgets/page_item.html
Normal 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 %}
|
||||
|
28
aircox/templates/aircox/widgets/page_list.html
Normal file
28
aircox/templates/aircox/widgets/page_list.html
Normal 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 %}
|
||||
|
||||
|
8
aircox/templates/aircox/widgets/podcast_item.html
Normal file
8
aircox/templates/aircox/widgets/podcast_item.html
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="podcast">
|
||||
{% if object.embed %}
|
||||
{{ object.embed|safe }}
|
||||
{% else %}
|
||||
<audio src="{{ object.url }}" controls>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
12
aircox/templates/aircox/widgets/track_item.html
Normal file
12
aircox/templates/aircox/widgets/track_item.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% comment %}
|
||||
Context:
|
||||
- object: track to render
|
||||
{% endcomment %}
|
||||
|
||||
<span class="has-text-info is-size-5">♬</span>
|
||||
<span>{{ object.title }}</span>
|
||||
<span class="has-text-grey-dark has-text-weight-light">
|
||||
— {{ object.artist }}
|
||||
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
|
||||
</span>
|
||||
|
Reference in New Issue
Block a user