Merge pull request '#15: épisode supprimé (mis à la corbeille) reste visible publiquement ?' (#29) from fix-1.0-15 into develop-1.0
Reviewed-on: #29
This commit is contained in:
		@ -62,6 +62,13 @@ class Episode(Page):
 | 
			
		||||
            raise ValueError('missing parent program')
 | 
			
		||||
        super().save(*args, **kwargs)
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def get_default_title(cls, page, date):
 | 
			
		||||
        return settings.AIRCOX_EPISODE_TITLE.format(
 | 
			
		||||
            program=page,
 | 
			
		||||
            date=date.strftime(settings.AIRCOX_EPISODE_TITLE_DATE_FORMAT)
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def get_init_kwargs_from(cls, page, date, title=None, **kwargs):
 | 
			
		||||
        """ Get default Episode's title  """
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										65
									
								
								aircox/templates/aircox/widgets/basepage_item.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								aircox/templates/aircox/widgets/basepage_item.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,65 @@
 | 
			
		||||
{% load i18n easy_thumbnails_tags aircox %}
 | 
			
		||||
{% comment %}
 | 
			
		||||
List item for a page
 | 
			
		||||
 | 
			
		||||
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|default:station.default_cover 480x480 %}">
 | 
			
		||||
        </figure>
 | 
			
		||||
    </header>
 | 
			
		||||
    <div class="card-header">
 | 
			
		||||
        <h4 class="title">
 | 
			
		||||
            <a href="{{ object.get_absolute_url }}">
 | 
			
		||||
                {% block card_title %}{{ object.title }}{% endblock %}
 | 
			
		||||
            </a>
 | 
			
		||||
        </h4>
 | 
			
		||||
    </div>
 | 
			
		||||
</article>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% else %}
 | 
			
		||||
<article class="media item {% block css %}{% endblock%}">
 | 
			
		||||
    {% if has_cover|default_if_none:True %}
 | 
			
		||||
    <div class="media-left">
 | 
			
		||||
        <img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
 | 
			
		||||
            class="cover is-small">
 | 
			
		||||
    </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 }}{% endblock %}
 | 
			
		||||
        </div>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    {% block actions %}{% endblock %}
 | 
			
		||||
</article>
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,11 @@ Context variables:
 | 
			
		||||
{% block title %}
 | 
			
		||||
{% if not object.is_published and object.program.is_published %}
 | 
			
		||||
<a href="{{ object.program.get_absolute_url }}">
 | 
			
		||||
    {{ object.title }}
 | 
			
		||||
    {{ object.program.title }}
 | 
			
		||||
    {% if diffusion %}
 | 
			
		||||
    —
 | 
			
		||||
    {{ diffusion.start|date:"d F" }}
 | 
			
		||||
    {% endif %}
 | 
			
		||||
</a>
 | 
			
		||||
{% else %}
 | 
			
		||||
{{ block.super }}
 | 
			
		||||
 | 
			
		||||
@ -1,62 +1,6 @@
 | 
			
		||||
{% load i18n easy_thumbnails_tags aircox %}
 | 
			
		||||
{% comment %}
 | 
			
		||||
List item for a page
 | 
			
		||||
{% extends "aircox/widgets/basepage_item.html" %}
 | 
			
		||||
 | 
			
		||||
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|default:station.default_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 {% block css %}{% endblock%}">
 | 
			
		||||
    {% if has_cover|default_if_none:True %}
 | 
			
		||||
    <div class="media-left">
 | 
			
		||||
        <img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
 | 
			
		||||
            class="cover is-small">
 | 
			
		||||
    </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 }}{% endblock %}
 | 
			
		||||
        </div>
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    {% block actions %}{% endblock %}
 | 
			
		||||
</article>
 | 
			
		||||
{% endif %}
 | 
			
		||||
{% block card_title %}
 | 
			
		||||
{% block title %}{{ block.super }}{% endblock %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user