Skip to content

Commit

Permalink
Refactorise les templates des publications
Browse files Browse the repository at this point in the history
* mise à jour de l'organisation des différentes actions possibles
* fusion des variantes en ligne et pas en ligne
* configuration définie dans la vue pour adapter l'affichage
* vues bien séparées pour bêta, brouillon, en ligne
* nouvelle vue spécifique pour voir une version par son commit
  • Loading branch information
Arnaud-D committed Feb 15, 2023
1 parent 340ab0d commit 5e44438
Show file tree
Hide file tree
Showing 86 changed files with 3,181 additions and 2,971 deletions.
3 changes: 0 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@
<meta property="twitter:creator" content="@{% block twitter_creator %}{{app.site.name}}{% endblock %}">
<meta property="twitter:image" content="http://{{ meta_image }}">


{# DCMI cards #}
{% block DCMI_cards %}{% endblock %}


{# Stylesheets #}
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css"
Expand Down
22 changes: 10 additions & 12 deletions templates/featured/includes/featured_request.part.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{% if show_featured_requested %}
<form action="{{ link }}" method="post">
<input type="hidden" name="request_featured" value="1">
{% csrf_token %}
<form action="{{ link }}" method="post">
<input type="hidden" name="request_featured" value="1">
{% csrf_token %}

<button
class="requesting ico-after star {% if is_requesting %}yellow{% else %}blue{% endif %}"
type="submit" data-ajax-input="request-featured">
<span id="request_text" data-content-on-click="{{ data_onclick }}">{{ button_text }}</span>
{% include 'featured/includes/featured_request_count.part.html' with featured_request_count=featured_request_count %}
</button>
</form>
{% endif %}
<button
class="requesting ico-after star {% if is_requesting %}yellow{% else %}blue{% endif %}"
type="submit" data-ajax-input="request-featured">
<span id="request_text" data-content-on-click="{{ data_onclick }}">{{ button_text }}</span>
{% include 'featured/includes/featured_request_count.part.html' with featured_request_count=featured_request_count %}
</button>
</form>
9 changes: 0 additions & 9 deletions templates/tutorialv2/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,5 @@ <h3>{% trans "Actions" %}</h3>
{% endif %}

{% block sidebar_blocks %}{% endblock %}
{% if content %}
{% if content.is_public or content.in_beta or can_edit or is_staff %}
<div class="mobile-menu-bloc mobile-all-links mobile-show-ico" data-title="Télécharger">
{% if not public_object or public_object.is_exported %}
{% include "tutorialv2/includes/list_of_exports.html" %}
{% endif %}
</div>
{% endif %}
{% endif %}
</aside>
{% endblock %}
4 changes: 2 additions & 2 deletions templates/tutorialv2/events/descriptions.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


{% elif event.type == "beta_management" %}
{% captureas version_href %}{% url "content:view" event.content.pk event.content.slug %}?version={{ event.version }}{% endcaptureas %}
{% url "content:view-version" pk=event.content.pk slug=event.content.slug version=event.version as version_href %}
{% if event.action == "activate" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a mis une <a href="{{ version_href }}">version du contenu</a> en bêta.
{% elif event.action == "deactivate" %}
Expand All @@ -37,7 +37,7 @@


{% elif event.type == "validation_management" %}
{% captureas version_href %}{% url "content:view" event.content.pk event.content.slug %}?version={{ event.version }}{% endcaptureas %}
{% url "content:view-version" pk=event.content.pk slug=event.content.slug version=event.version as version_href %}
{% if event.action == "request" %}
<a href="{{ performer_href }}">{{ event.performer }}</a> a demandé la validation d'une <a href="{{ version_href }}">version du contenu</a>.
{% elif event.action == "cancel" %}
Expand Down
8 changes: 0 additions & 8 deletions templates/tutorialv2/events/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@


{% block headline %}
{% if content.licence %}
<p class="license">
{{ content.licence }}
</p>
{% endif %}

<h1 {% if content.image %}class="illu"{% endif %}>
{% if content.image %}
<img src="{{ content.image.physical.tutorial_illu.url }}" alt="">
Expand All @@ -41,8 +35,6 @@ <h2 class="subtitle">
{{ content.description }}
</h2>
{% endif %}

{% include 'tutorialv2/includes/tags_authors.part.html' with content=content online=False %}
{% endblock %}


Expand Down
50 changes: 9 additions & 41 deletions templates/tutorialv2/includes/chapter_pager.part.html
Original file line number Diff line number Diff line change
@@ -1,59 +1,27 @@
{% load i18n %}

{% if has_pagination %}

{% if pager.has_pagination %}
<ul class="pagination pagination-{{ position }} pagination-chapter">
{% if previous %}
{% if pager.previous %}
<li class="prev">
<a
{% if online %}
href="{{ previous.get_absolute_url_online }}"
{% elif content.is_beta %}
href="{{ previous.get_absolute_url_beta }}"
{% else %}
href="{{ previous.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}"
{% endif %}
class="ico-after arrow-left"
rel="prev"
>
{{ previous.title }}
<a href="{{ pager.previous.url }}" class="ico-after arrow-left" rel="prev">
{{ pager.previous.title }}
</a>
</li>
{% endif %}

{% if container.parent %}
<li class="summary-button">
<a
{% if online %}
href="{{ content.get_absolute_url_online }}"
{% elif content.is_beta %}
href="{{ content.get_absolute_url_beta }}"
{% else %}
href="{{ content.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}"
{% endif %}
>
{% trans "Sommaire" %}
</a>
<a href="{{ base_url }}{{ container.parent.get_url_path }}">{% trans "Sommaire" %}</a>
</li>
{% endif %}

{% if next %}
{% if pager.next %}
<li class="next">
<a
{% if online %}
href="{{ next.get_absolute_url_online }}"
{% elif content.is_beta %}
href="{{ next.get_absolute_url_beta }}"
{% else %}
href="{{ next.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}"
{% endif %}
class="ico-after arrow-right"
rel="next"
>
{{ next.title }}
<a href="{{ pager.next.url }}" class="ico-after arrow-right" rel="next">
{{ pager.next.title }}
</a>
</li>
{% endif %}
</ul>

{% endif %}
106 changes: 42 additions & 64 deletions templates/tutorialv2/includes/child.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,15 @@
{% load times %}
{% load target_tree %}
{% load feminize %}
{% load captureas %}

<h2 id="{{ child.position_in_parent }}-{{ child.slug }}"
{% if not child.is_validable %}
class="not-ready"
{% endif %}>
<a
{% if content.is_beta %}
href="{{ child.get_absolute_url_beta }}"
{% else %}
{% if child.text %}
href="{{ child.container.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}#{{ child.position_in_parent }}-{{ child.slug }}"
{% else %}
href="{{ child.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}"
{% endif %}
{% endif %}
>
{{ child.title }}
</a>
<a href="{{ base_url }}{{ child.get_url_path }}">{{ child.title }}</a>

{% if can_add_something %}
{% if display_config.draft_actions.enable_edit %}
<div class="actions-title">
<a href="{{ child.get_edit_url }}" class="ico-after edit btn btn-grey">
{% trans "Éditer" %}
Expand Down Expand Up @@ -67,7 +56,8 @@
{% trans "Déplacer" %}
</button>
</form>
{% include "tutorialv2/includes/delete.part.html" with object=child additional_classes="ico-after cross btn btn-grey" %}

{% include "tutorialv2/includes/sidebar/delete.part.html" with object=child additional_classes="ico-after cross btn btn-grey" %}
</div>
{% endif %}
</h2>
Expand All @@ -77,7 +67,7 @@
{% if child.get_text.strip|length == 0 %}
<div class="ico-after warning">
<p>
{% trans "Cette section est actuellement vide." %}
{% trans "Cette section est vide." %}
</p>
</div>
{% else %}
Expand All @@ -92,16 +82,12 @@
<ol>
{% for extract in child.children %}
<li>
<a
{% if content.is_beta %}
href="{{ extract.get_absolute_url_beta }}"
{% else %}
href="{{ extract.container.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}#{{ extract.position_in_parent }}-{{ extract.slug }}"
{% endif %}
>{{ extract.title }}</a>
<a href="{{ base_url }}{{ extract.get_url_path }}">
{{ extract.title }}
</a>
</li>
{% endfor %}
{% if can_add_something and child.can_add_extract %}
{% if display_config.draft_actions.enable_edit and child.can_add_extract %}
<li class="simple-create-button">
<a class="btn btn-grey" href="{% if child.parent == content %}
{% url "content:create-extract" content.pk content.slug child.slug %}
Expand All @@ -118,29 +104,19 @@
{% for subchild in child.children %}
<li>
<h3 class="{% if not subchild.ready_to_publish %}not-ready{% endif %}">
<a
{% if content.is_beta %}
href="{{ subchild.get_absolute_url_beta }}"
{% else %}
href="{{ subchild.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}"
{% endif %}
>{{ subchild.title }}</a>
<a href="{{ base_url }}{{ subchild.get_url_path }}">{{ subchild.title }}</a>
</h3>
<ol class="summary-part">
{% for extract in subchild.children %}
<li>
<h4>
<a
{% if content.is_beta %}
href="{{ extract.get_absolute_url_beta }}"
{% else %}
href="{{ extract.container.get_absolute_url }}{% if version %}?version={{ version }}{% endif %}#{{ extract.position_in_parent }}-{{ extract.slug }}"
{% endif %}
>{{ extract.title }}</a>
<a href="{{ base_url }}{{ extract.get_url_path }}">
{{ extract.title }}
</a>
</h4>
</li>
{% endfor %}
{% if can_add_something %}
{% if display_config.draft_actions.enable_edit %}
<li class="simple-create-button">
<h4>
<a class="btn btn-grey"
Expand All @@ -152,7 +128,7 @@ <h4>
</ol>
</li>
{% endfor %}
{% if can_add_something and child.can_add_container %}
{% if display_config.draft_actions.enable_edit and child.can_add_container %}
<li>
<h3>
<a class="force-blue"
Expand All @@ -167,32 +143,34 @@ <h3>
{% endif %}
</ol>
{% else %}
{% if not can_add_something or not child.is_chapter %}
<div class="ico-after warning">
<p>
{{ "Ce"|feminize:child.get_level_as_string }} {{ child.get_level_as_string|lower }} {% trans "est actuellement vide." %}
</p>
{% if can_add_something and not child.is_chapter %}
<ul>
<li>
<a href="{% url "content:create-container" content.pk content.slug child.slug %}">{% trans "Ajouter un chapitre" %}</a>
{% trans " pour adopter le format big-tuto et ajouter des sections ;" %}
</li>
<li>
<a href="{% url "content:create-extract" content.pk content.slug child.slug %}">{% trans "Ajouter une section" %}</a>
{% trans " pour adopter le format moyen-tuto, composé uniquement de sections." %}
{% if display_config.draft_actions.enable_edit %}
{% if not child.is_chapter %}
<div class="ico-after warning">
<p>
{{ "Ce"|feminize:child.get_level_as_string }} {{ child.get_level_as_string|lower }} {% trans "est vide." %}
</p>
{% if not child.is_chapter %}
<ul>
<li>
<a href="{% url "content:create-container" content.pk content.slug child.slug %}">{% trans "Ajouter un chapitre" %}</a>
{% trans " pour adopter le format big-tuto et ajouter des sections ;" %}
</li>
<li>
<a href="{% url "content:create-extract" content.pk content.slug child.slug %}">{% trans "Ajouter une section" %}</a>
{% trans " pour adopter le format moyen-tuto, composé uniquement de sections." %}
</li>
</ul>
{% endif %}
</div>
{% elif child.can_add_extract and child.is_chapter %}
<ol>
<li class="simple-create-button">
<a class="btn btn-grey" href="{% url "content:create-extract" content.pk content.slug child.parent.slug child.slug %}">
{% trans "Ajouter une section" %}
</a>
</li>
</ul>
</ol>
{% endif %}
</div>
{% elif can_add_something and child.can_add_extract and child.is_chapter %}
<ol>
<li class="simple-create-button">
<a class="btn btn-grey" href="{% url "content:create-extract" content.pk content.slug child.parent.slug child.slug %}">
{% trans "Ajouter une section" %}
</a>
</li>
</ol>
{% endif %}
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion templates/tutorialv2/includes/child_online.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2 id="{{ child.position_in_parent }}-{{ child.slug }}">
{# child is an extract #}
{% if child.get_text.strip|length == 0 %}
<p class="ico-after warning">
{% trans "Cette section est actuellement vide." %}
{% trans "Cette section est vide." %}
</p>
{% else %}
<div class="extract-wrapper">
Expand Down
Loading

0 comments on commit 5e44438

Please sign in to comment.