diff --git a/templates/tutorialv2/includes/sidebar/administration_actions.part.html b/templates/tutorialv2/includes/sidebar/administration_actions.part.html
index 2ae5450331..55507d9b11 100644
--- a/templates/tutorialv2/includes/sidebar/administration_actions.part.html
+++ b/templates/tutorialv2/includes/sidebar/administration_actions.part.html
@@ -7,12 +7,6 @@
{% trans "Administration" %}
- {% if administration_actions.show_exports_request %}
- -
- {% include "tutorialv2/includes/sidebar/exports.part.html" %}
-
- {% endif %}
-
{% if administration_actions.show_versions_history_link %}
-
diff --git a/templates/tutorialv2/includes/sidebar/exports.part.html b/templates/tutorialv2/includes/sidebar/exports.part.html
index 2dbd95122c..c15975aee5 100644
--- a/templates/tutorialv2/includes/sidebar/exports.part.html
+++ b/templates/tutorialv2/includes/sidebar/exports.part.html
@@ -1,10 +1,11 @@
+{% load get_item %}
{% load i18n %}
- {% trans "Exports du contenu" %}
+ {{ public_actions.messages|get_item:"export_content" }}
diff --git a/templates/tutorialv2/includes/sidebar/public_actions.part.html b/templates/tutorialv2/includes/sidebar/public_actions.part.html
index acb2a03e2f..e028195fcf 100644
--- a/templates/tutorialv2/includes/sidebar/public_actions.part.html
+++ b/templates/tutorialv2/includes/sidebar/public_actions.part.html
@@ -64,6 +64,12 @@
{% trans "Version publique" %}
{% endif %}
+ {% if public_actions.show_exports_request %}
+
-
+ {% include "tutorialv2/includes/sidebar/exports.part.html" %}
+
+ {% endif %}
+
{% if public_actions.show_content_revoke %}
-
diff --git a/zds/tutorialv2/tests/tests_views/tests_display.py b/zds/tutorialv2/tests/tests_views/tests_display.py
index 3757220159..e48d0fad1a 100644
--- a/zds/tutorialv2/tests/tests_views/tests_display.py
+++ b/zds/tutorialv2/tests/tests_views/tests_display.py
@@ -40,12 +40,14 @@ def test_sidebar_items(self):
self.assertContains(public_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(public_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(public_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertContains(public_page, PublicActionsState.messages["export_content"])
self.assertNotContains(public_page, ValidationActions.messages["validation_is_same"])
# Draft page:
draft_page = self.client.get(reverse("content:view", args=[article.pk, article.slug]), follow=False)
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_more_recent"])
self.assertContains(draft_page, PublicActionsState.messages["public_is_same"])
+ self.assertNotContains(draft_page, PublicActionsState.messages["export_content"])
self.assertNotContains(draft_page, ValidationActions.messages["validation_is_same"])
# Create a new draft version:
@@ -71,6 +73,7 @@ def test_sidebar_items(self):
self.assertNotContains(public_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(public_page, PublicActionsState.messages["public_is_same"])
self.assertContains(public_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertContains(public_page, PublicActionsState.messages["export_content"])
self.assertNotContains(public_page, ValidationActions.messages["validation_is_same"])
# Draft page:
draft_page = self.client.get(reverse("content:view", args=[article.pk, article.slug]), follow=False)
@@ -78,6 +81,7 @@ def test_sidebar_items(self):
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertNotContains(draft_page, PublicActionsState.messages["export_content"])
self.assertNotContains(draft_page, ValidationActions.messages["validation_is_same"])
# Ask validation:
@@ -87,12 +91,14 @@ def test_sidebar_items(self):
self.assertNotContains(public_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(public_page, PublicActionsState.messages["public_is_same"])
self.assertContains(public_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertContains(public_page, PublicActionsState.messages["export_content"])
self.assertNotContains(public_page, ValidationActions.messages["validation_is_same"])
# Draft page:
draft_page = self.client.get(reverse("content:view", args=[article.pk, article.slug]), follow=False)
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertNotContains(draft_page, PublicActionsState.messages["export_content"])
self.assertContains(draft_page, ValidationActions.messages["validation_is_same"])
# Validation page:
validation_page = self.client.get(
@@ -101,6 +107,7 @@ def test_sidebar_items(self):
self.assertNotContains(validation_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(validation_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(validation_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertNotContains(validation_page, PublicActionsState.messages["export_content"])
self.assertNotContains(validation_page, ValidationActions.messages["validation_is_same"])
# Now a new draft version, to have different version from validation:
@@ -126,6 +133,7 @@ def test_sidebar_items(self):
self.assertNotContains(public_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(public_page, PublicActionsState.messages["public_is_same"])
self.assertContains(public_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertContains(public_page, PublicActionsState.messages["export_content"])
self.assertNotContains(public_page, ValidationActions.messages["validation_is_same"])
# Draft page:
draft_page = self.client.get(reverse("content:view", args=[article.pk, article.slug]), follow=False)
@@ -133,6 +141,7 @@ def test_sidebar_items(self):
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(draft_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertNotContains(draft_page, PublicActionsState.messages["export_content"])
self.assertNotContains(draft_page, ValidationActions.messages["validation_is_same"])
# Validation page:
validation_page = self.client.get(
@@ -141,4 +150,5 @@ def test_sidebar_items(self):
self.assertNotContains(validation_page, PublicActionsState.messages["draft_is_same"])
self.assertNotContains(validation_page, PublicActionsState.messages["public_is_same"])
self.assertNotContains(validation_page, PublicActionsState.messages["draft_is_more_recent"])
+ self.assertNotContains(validation_page, PublicActionsState.messages["export_content"])
self.assertNotContains(validation_page, ValidationActions.messages["validation_is_same"])
diff --git a/zds/tutorialv2/views/display/config.py b/zds/tutorialv2/views/display/config.py
index f7380e0a14..7e6344a4cf 100644
--- a/zds/tutorialv2/views/display/config.py
+++ b/zds/tutorialv2/views/display/config.py
@@ -19,8 +19,7 @@ def show_block(self) -> bool:
self.enabled
and self.is_allowed
and (
- self.show_exports_request()
- or self.show_versions_history_link()
+ self.show_versions_history_link()
or self.show_events_history_link()
or self.show_opinion_publish()
or self.show_opinion_moderated()
@@ -29,9 +28,6 @@ def show_block(self) -> bool:
)
)
- def show_exports_request(self) -> bool:
- return self.is_allowed
-
def show_versions_history_link(self) -> bool:
return self.is_allowed
@@ -56,6 +52,7 @@ class PublicActionsState:
"draft_is_same": _("La version brouillon est identique à cette version."),
"draft_is_more_recent": _("La version brouillon est plus récente que cette version."),
"public_is_same": _("La version publique est identique à cette version."),
+ "export_content": _("Exports du contenu"),
}
def __init__(self, user, content: PublishableContent, versioned_content: VersionedContent):
@@ -74,6 +71,7 @@ def show_block(self) -> bool:
and self.is_author_or_staff
and (
self.show_stats_link()
+ or self.show_exports_request()
or self.show_identical_public_version_message()
or self.show_identical_draft_version_message()
or self.show_more_recent_draft_version_link()
@@ -85,6 +83,9 @@ def show_block(self) -> bool:
)
)
+ def show_exports_request(self) -> bool:
+ return self.is_author_or_staff and self.in_public and self.is_public_page
+
def show_stats_link(self) -> bool:
return self.is_author_or_staff and self.in_public