-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mets les bons liens sur la page principale d'un contenu
- Loading branch information
Showing
4 changed files
with
168 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{% load emarkdown %} | ||
{% load i18n %} | ||
{% load times %} | ||
{% load target_tree %} | ||
|
||
{% if not hide_title %} | ||
<h2 id="{{ child.position_in_parent }}-{{ child.slug }}"> | ||
<a href="{{ child.get_relative_url }}"> | ||
{{ child.title }} | ||
</a> | ||
</h2> | ||
{% endif %} | ||
{% if child.text %} | ||
{# child is an extract #} | ||
{% if child.get_text.strip|length == 0 %} | ||
<p class="ico-after warning"> | ||
{% trans "Cette section est actuellement vide." %} | ||
</p> | ||
{% else %} | ||
<div class="extract-wrapper"> | ||
{{ child.get_text|emarkdown:is_js }} | ||
</div> | ||
{% endif %} | ||
{% else %} | ||
{# child is a container #} | ||
|
||
{% if child.has_extracts %} | ||
<ol> | ||
{% for extract in child.children %} | ||
<li> | ||
<a href="{{ extract.container.get_relative_url }}#{{ extract.position_in_parent }}-{{ extract.slug }}">{{ extract.title }}</a> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
{% elif child.has_sub_containers %} | ||
<ol class="summary-part"> | ||
{% for subchild in child.children %} | ||
<li> | ||
<h3> | ||
<a | ||
href="{{ subchild.get_relative_url }}" | ||
|
||
>{{ subchild.title }}</a> | ||
</h3> | ||
<ol class="summary-part"> | ||
{% for extract in subchild.children %} | ||
<li> | ||
<h4> | ||
<a href="{{ extract.container.get_relative_url }}#{{ extract.position_in_parent }}-{{ extract.slug }}">{{ extract.title }}</a> | ||
</h4> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
</li> | ||
{% endfor %} | ||
</ol> | ||
{% endif %} | ||
{% endif %} | ||
|
||
|
||
{% if not child.has_sub_containers %} | ||
</li> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,96 @@ | ||
{% extends "tutorialv2/base.html" %} | ||
{% extends "tutorialv2/base_online.html" %} | ||
{% load i18n %} | ||
{% load captureas %} | ||
|
||
{% block title %} | ||
{{ content.title }} | ||
{% endblock %} | ||
|
||
{% block breadcrumb %} | ||
<li>{{ content.title }}</li> | ||
{% endblock %} | ||
|
||
{% block headline %} | ||
{% if content.licence %} | ||
<span class="license" itemprop="license"> | ||
{{ content.licence }} | ||
</span> | ||
{% endif %} | ||
|
||
<h1 {% if content.image %}class="illu"{% endif %} itemprop="name"> | ||
{% if content.image %} | ||
<img src="{{ content.image.physical.tutorial_illu.url }}" alt="" itemprop="thumbnailUrl"> | ||
{% endif %} | ||
{{ content.title }} | ||
</h1> | ||
|
||
{% if content.description %} | ||
<h2 class="subtitle" itemprop="description"> | ||
{{ content.description }} | ||
</h2> | ||
{% endif %} | ||
|
||
{% include 'tutorialv2/includes/tags_authors.part.html' with publishablecontent=content online=False %}{% if content.is_opinion %} | ||
{% if content.converted_to %} | ||
{% if content.converted_to.get_absolute_url_online %} | ||
<div class="alert-box info"> | ||
{% blocktrans with url_article=content.converted_to.get_absolute_url_online %} | ||
Ce billet a été promu en <a href="{{ url_article }}">article</a>. | ||
{% endblocktrans %} | ||
</div> | ||
{% elif is_staff %} | ||
<div class="alert-box info"> | ||
{% blocktrans with url_article=content.converted_to.get_absolute_url %} | ||
Ce billet a fait l’objet d’une demande de publication <a href="{{ url_article }}">en tant qu’article</a>. Il est donc présent dans la zone de validation en attente de prise en charge par un validateur. | ||
{% endblocktrans %} | ||
</div> | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
Contenu : {{ content.title }} | ||
{% captureas content_pager %} | ||
{% include "tutorialv2/includes/content_pager.part.html" with content=content %} | ||
{% endcaptureas %} | ||
|
||
{{ content_pager }} | ||
|
||
{% if content.has_extracts %} | ||
{{ content.get_content_online|safe }} | ||
{% else %} | ||
{% if content.introduction %} | ||
{{ content.get_introduction|default:""|safe }} | ||
{% endif %} | ||
|
||
{% if not content.has_sub_containers %} | ||
<ol class="summary-part"> | ||
{% endif %} | ||
|
||
{% captureas url %} | ||
{% url "content:shareable-link" link.id %} | ||
{% endcaptureas %} | ||
|
||
{% for child in content.children %} | ||
{% include "tutorialv2/includes/shared_content_child.html" with url=url 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 %} | ||
{{ content_pager }} | ||
{% include "tutorialv2/includes/alert.html" with content=content current_content_type=current_content_type %} | ||
{% include "tutorialv2/includes/warn_typo.part.html" with content=content %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
from django.core.exceptions import PermissionDenied | ||
from django.shortcuts import get_object_or_404 | ||
from django.views.generic import TemplateView, DetailView | ||
from django.views.generic import TemplateView | ||
|
||
from zds.tutorialv2.mixins import ContentTypeMixin | ||
from zds.tutorialv2.models.database import ShareableLink | ||
|
||
|
||
class DisplaySharedContent(TemplateView): | ||
class DisplaySharedContent(ContentTypeMixin, TemplateView): | ||
"""View a shared version of a content.""" | ||
|
||
template_name = "tutorialv2/view/shared_content.html" | ||
|
||
def setup(self, request, *args, **kwargs): | ||
super().setup(request, *args, **kwargs) | ||
link = get_object_or_404(ShareableLink, id=kwargs["id"]) | ||
if not link.active: | ||
def dispatch(self, request, *args, **kwargs): | ||
self.link = get_object_or_404(ShareableLink, id=kwargs["id"]) | ||
if not self.link.active: | ||
raise PermissionDenied | ||
self.content = link.content | ||
self.content = self.link.content | ||
return super().dispatch(request, *args, **kwargs) | ||
|
||
def get_context_data(self, **kwargs): | ||
kwargs = super().get_context_data() | ||
kwargs["content"] = self.content | ||
return kwargs | ||
versioned_model = self.content.load_version_or_404(sha=self.content.sha_draft, public=self) | ||
kwargs["link"] = self.link | ||
kwargs["content"] = versioned_model | ||
return super().get_context_data(**kwargs) |