mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
documentation: Support having no sidebar for policies docs.
We document the sidebar as being optional, so make it so.
(cherry picked from commit 1455690486)
This commit is contained in:
committed by
Tim Abbott
parent
042a4ab858
commit
443a2afa5d
1
templates/zerver/policies_minimal/privacy.md
Normal file
1
templates/zerver/policies_minimal/privacy.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This is the custom privacy policy.
|
||||||
1
templates/zerver/policies_minimal/terms.md
Normal file
1
templates/zerver/policies_minimal/terms.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
These are the custom terms and conditions.
|
||||||
@@ -694,6 +694,10 @@ class PrivacyTermsTest(ZulipTestCase):
|
|||||||
response = self.client_get("/policies/terms")
|
response = self.client_get("/policies/terms")
|
||||||
self.assert_in_response(not_configured_message, response)
|
self.assert_in_response(not_configured_message, response)
|
||||||
|
|
||||||
|
with self.settings(POLICIES_DIRECTORY="zerver/policies_minimal"):
|
||||||
|
response = self.client_get("/policies/terms")
|
||||||
|
self.assert_in_success_response(["These are the custom terms and conditions."], response)
|
||||||
|
|
||||||
with self.settings(POLICIES_DIRECTORY="corporate/policies"):
|
with self.settings(POLICIES_DIRECTORY="corporate/policies"):
|
||||||
response = self.client_get("/policies/terms")
|
response = self.client_get("/policies/terms")
|
||||||
self.assert_in_success_response(["Kandra Labs"], response)
|
self.assert_in_success_response(["Kandra Labs"], response)
|
||||||
@@ -704,6 +708,10 @@ class PrivacyTermsTest(ZulipTestCase):
|
|||||||
response = self.client_get("/policies/privacy")
|
response = self.client_get("/policies/privacy")
|
||||||
self.assert_in_response(not_configured_message, response)
|
self.assert_in_response(not_configured_message, response)
|
||||||
|
|
||||||
|
with self.settings(POLICIES_DIRECTORY="zerver/policies_minimal"):
|
||||||
|
response = self.client_get("/policies/privacy")
|
||||||
|
self.assert_in_success_response(["This is the custom privacy policy."], response)
|
||||||
|
|
||||||
with self.settings(POLICIES_DIRECTORY="corporate/policies"):
|
with self.settings(POLICIES_DIRECTORY="corporate/policies"):
|
||||||
response = self.client_get("/policies/privacy")
|
response = self.client_get("/policies/privacy")
|
||||||
self.assert_in_success_response(["Kandra Labs"], response)
|
self.assert_in_success_response(["Kandra Labs"], response)
|
||||||
|
|||||||
@@ -182,7 +182,10 @@ class MarkdownDirectoryView(ApiURLView):
|
|||||||
context["doc_root"] = "/policies/"
|
context["doc_root"] = "/policies/"
|
||||||
context["doc_root_title"] = "Terms and policies"
|
context["doc_root_title"] = "Terms and policies"
|
||||||
sidebar_article = self.get_path("sidebar_index")
|
sidebar_article = self.get_path("sidebar_index")
|
||||||
sidebar_index = sidebar_article.article_path
|
if sidebar_article.article_http_status == 200:
|
||||||
|
sidebar_index = sidebar_article.article_path
|
||||||
|
else:
|
||||||
|
sidebar_index = None
|
||||||
title_base = "Zulip terms and policies"
|
title_base = "Zulip terms and policies"
|
||||||
elif self.api_doc_view:
|
elif self.api_doc_view:
|
||||||
context["page_is_api_center"] = True
|
context["page_is_api_center"] = True
|
||||||
@@ -234,7 +237,10 @@ class MarkdownDirectoryView(ApiURLView):
|
|||||||
if endpoint_name and endpoint_method:
|
if endpoint_name and endpoint_method:
|
||||||
context["api_url_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method
|
context["api_url_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method
|
||||||
|
|
||||||
sidebar_html = render_markdown_path(sidebar_index)
|
if sidebar_index is not None:
|
||||||
|
sidebar_html = render_markdown_path(sidebar_index)
|
||||||
|
else:
|
||||||
|
sidebar_html = ""
|
||||||
tree = html.fragment_fromstring(sidebar_html, create_parent=True)
|
tree = html.fragment_fromstring(sidebar_html, create_parent=True)
|
||||||
if not context.get("page_is_policy_center", False):
|
if not context.get("page_is_policy_center", False):
|
||||||
home_h1 = Element("h1")
|
home_h1 = Element("h1")
|
||||||
|
|||||||
Reference in New Issue
Block a user