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 Jan 26, 2023
1 parent d23dbc6 commit 9a464da
Show file tree
Hide file tree
Showing 71 changed files with 2,495 additions and 2,191 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 %}
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
59 changes: 31 additions & 28 deletions templates/tutorialv2/includes/child.part.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{ 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 +67,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 +78,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 Down Expand Up @@ -152,7 +153,7 @@ <h4>
</ol>
</li>
{% endfor %}
{% if can_add_something and child.can_add_container %}
{% if child.can_add_container %}
<li>
<h3>
<a class="force-blue"
Expand All @@ -167,32 +168,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
78 changes: 78 additions & 0 deletions templates/tutorialv2/includes/comments.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{% load i18n %}
{% load pluralize_fr %}
{% load captureas %}
{% load set %}

<h3 class="comments-title" id="comments">
{% if content.get_note_count > 0 %}
<span itemprop="commentCount">
{{ content.get_note_count }}
</span>
{% trans "commentaire" %}{{ content.get_note_count|pluralize_fr }}
{% else %}
{% trans "Aucun commentaire" %}
{% endif %}
</h3>


{% include "misc/paginator.html" with position="top" topic=content is_online=True anchor="comments" %}

{% for message in reactions %}

{% captureas edit_link %}
{% url "content:update-reaction" %}?message={{ message.pk }}&amp;pk={{ content.pk }}
{% endcaptureas %}

{% captureas cite_link %}
{% url "content:add-reaction" %}?cite={{ message.pk }}&amp;pk={{ content.pk }}
{% endcaptureas %}

{% captureas karma_link %}
{% url "api:content:reaction-karma" message.pk %}
{% endcaptureas %}

{% captureas alerts_solve_link %}
{% url "content:resolve-reaction" %}
{% endcaptureas %}
{% captureas alert_link %}
{% url "content:alert-reaction" message.pk %}
{% endcaptureas %}
{% captureas hide_link %}
{% url "content:hide-reaction" message.pk%}
{% endcaptureas %}

{% captureas show_link %}
{% url "content:show-reaction" message.pk %}
{% endcaptureas %}

{% if forloop.first and page_obj.number > 1 %}
{% set True as is_repeated_message %}
{% else %}
{% set False as is_repeated_message %}
{% endif %}

{% if user == message.author or perms.tutorialv2.change_contentreaction %}
{% set True as can_view_history %}
{% else %}
{% set False as can_view_history %}
{% endif %}

{% include "misc/message.part.html" with perms_change=perms.tutorialv2.change_contentreaction topic=object %}
{% endfor %}


{% include "misc/paginator.html" with position="bottom" topic=content is_online=True anchor="comments" %}



{% captureas form_action %}
{% url 'content:add-reaction' %}?pk={{ content.pk }}
{% endcaptureas %}

{% if object.last_note %}
{% captureas last_note_pk %}
{{ object.last_note.pk }}
{% endcaptureas %}
{% endif %}

{% include "misc/message_form.html" with member=user topic=content is_antispam=is_antispam %}
112 changes: 112 additions & 0 deletions templates/tutorialv2/includes/content/content.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{% load i18n %}
{% load emarkdown %}

{% if content.introduction and content.get_introduction != "" %}
{{ content.get_introduction|emarkdown:is_js }}
{% elif display_config.draft_actions.show_empty_section_warnings %}
<div class="ico-after warning">
<p>
{% trans "Il n’y a pas d’introduction." %}
{% if can_add_something %}
{% trans "Vous pouvez " %}<a href="{% url "content:edit" content.pk content.slug %}">{% trans "en ajouter une" %}</a>.
{% endif %}
</p>
</div>
{% endif %}

{% if content.has_extracts or content.can_add_extract %}
<ul>
{% for extract in content.children %}
<li>
<a href="#{{ extract.position_in_parent }}-{{ extract.slug }}">
{{ extract.title }}
</a>
</li>
{% endfor %}
{% if not content.can_add_container and content.can_add_extract and display_config.draft_actions.enable_edit %}
<li class="simple-create-button">
<a class="btn btn-grey" href="{% url "content:create-extract" content.pk content.slug %}">
{% trans "Ajouter une section" %}
</a>
</li>
{% endif %}
</ul>
{% endif %}

{% for child in content.children %}
{% include "tutorialv2/includes/child.part.html" with child=child %}
{% empty %}
{% if content.can_add_extract and content.can_add_container and display_config.draft_actions.enable_edit %}
<div class="ico-after warning">
<p>
{% trans "Ce contenu est vide." %} {% trans "Vous pouvez :" %}
</p>
<ul>
<li>
<a href="{% url "content:create-container" content.pk content.slug %}">{% trans "Ajouter une partie" %}</a>
{% trans " pour adopter le format big-tuto ou moyen-tuto. Vous pourrez y ajouter des chapitres ou des sections ;" %}
</li>
<li>
<a href="{% url "content:create-extract" content.pk content.slug %}">{% trans "Ajouter une section" %}</a>
{% trans " pour adopter le format mini-tuto composé uniquement de sections." %}
</li>
</ul>
</div>
{% elif not display_config.draft_actions.enable_edit or not content.can_add_extract and not content.can_add_container %}
<div class="ico-after warning">
<p>
{% trans "Ce contenu est vide." %}
</p>
</div>
{% endif %}
{% endfor %}

{% if display_config.draft_actions.enable_edit %}
{% if content.can_add_container and not content.can_add_extract %}
<h2>
{% url "content:create-container" content.pk content.slug as create_container_url %}
<a class="force-blue" href="{{create_container_url}}">
{% trans "Ajouter une nouvelle partie" %}
</a>
<div class="actions-title">
<a href="{{ create_container_url }}" class="ico-after more btn btn-grey">
{% trans "Ajouter" %}
</a>
</div>
</h2>
{% endif %}

{% if not content.can_add_container and content.can_add_extract %}
<h2>
{% url "content:create-extract" content.pk content.slug as create_extract_url %}
<a class="force-blue" href="{{ create_extract_url }}">
{% trans "Ajouter une section" %}
</a>
<div class="actions-title">
<a href="{{ create_extract_url }}" class="ico-after more btn btn-grey">
{% trans "Ajouter" %}
</a>
</div>
</h2>
<div class="ico-after information">
<p>{% trans "Cliquer sur ajouter pour rédiger une nouvelle section." %}</p>
</div>
{% endif %}
{% endif %}


<hr class="clearfix" />
<hr />

{% if content.conclusion and content.get_conclusion != "" %}
{{ content.get_conclusion|emarkdown:is_js }}
{% elif display_config.draft_actions.show_empty_section_warnings %}
<div class="ico-after warning">
<p>
{% trans "Il n’y a pas de conclusion." %}
{% if display_config.draft_actions.enable_edit %}
{% trans "Vous pouvez " %}<a href="{% url "content:edit" content.pk content.slug %}">{% trans "en ajouter une" %}</a>.
{% endif %}
</p>
</div>
{% endif %}
27 changes: 27 additions & 0 deletions templates/tutorialv2/includes/content/online_content.part.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% if content.has_extracts %}
{{ content.get_content_online|safe }}
{% else %}
{% if content.introduction %}
{{ content.get_introduction_online|default:""|safe }}
{% endif %}

{% if not content.has_sub_containers %}
<ol class="summary-part">
{% endif %}

{% for child in content.children %}
{% include "tutorialv2/includes/child_online.part.html" with child=child %}
{% endfor %}

{% if not content.has_sub_containers %}
</ol>
{% endif %}

<hr class="clearfix" />
<hr />

{% if content.conclusion %}
{{ content.get_conclusion_online|default:""|safe }}
{% endif %}

{% endif %}
Loading

0 comments on commit 9a464da

Please sign in to comment.