From 7d9aa306612196540ff0a32d378cb72409aeb724 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Fri, 25 Nov 2022 12:58:58 +0100 Subject: [PATCH 01/21] Add announcent default --- .gitignore | 1 + doc/source/conf.py | 1 + src/ansys_sphinx_theme/announcement.html | 10 ++++++++++ src/ansys_sphinx_theme/announcements.html | 1 + src/ansys_sphinx_theme/layout.html | 6 ++++++ src/ansys_sphinx_theme/static/css/breadcrumbs.css | 9 +++++++++ 6 files changed, 28 insertions(+) create mode 100644 src/ansys_sphinx_theme/announcement.html create mode 100644 src/ansys_sphinx_theme/announcements.html diff --git a/.gitignore b/.gitignore index 3fbada88..b338adb8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ __pycache__/ # Distribution / packaging .Python build/ +_build/ develop-eggs/ dist/ downloads/ diff --git a/doc/source/conf.py b/doc/source/conf.py index 820de8e9..50e95d57 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -54,6 +54,7 @@ "switcher": { "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), + "preferred": True, }, "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], } diff --git a/src/ansys_sphinx_theme/announcement.html b/src/ansys_sphinx_theme/announcement.html new file mode 100644 index 00000000..8c715131 --- /dev/null +++ b/src/ansys_sphinx_theme/announcement.html @@ -0,0 +1,10 @@ +{% if theme_switcher and theme_switcher.get('preferred')== True %} +
+
+
+
+ {% include 'announcements.html' %} +
+
+
+{% endif %} diff --git a/src/ansys_sphinx_theme/announcements.html b/src/ansys_sphinx_theme/announcements.html new file mode 100644 index 00000000..3bb786d7 --- /dev/null +++ b/src/ansys_sphinx_theme/announcements.html @@ -0,0 +1 @@ +

You are not reading the most recent version of this documentation. Latest stable release is 1.0

\ No newline at end of file diff --git a/src/ansys_sphinx_theme/layout.html b/src/ansys_sphinx_theme/layout.html index 6b6e992c..45860c10 100644 --- a/src/ansys_sphinx_theme/layout.html +++ b/src/ansys_sphinx_theme/layout.html @@ -24,6 +24,12 @@ {% endif %} {% endblock %} + +{% block extrahead %} + {{ super() }} + {% include 'announcement.html' %} +{% endblock %} + {% block docs_navbar %} {{ super() }} {% if theme_show_breadcrumbs %} diff --git a/src/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/static/css/breadcrumbs.css index cc907569..7a695e23 100644 --- a/src/ansys_sphinx_theme/static/css/breadcrumbs.css +++ b/src/ansys_sphinx_theme/static/css/breadcrumbs.css @@ -21,4 +21,13 @@ body { *, :after, :before { box-sizing: border-box; +} + +#header-announcement{ + background-color: blueviolet; + +} + +#header-announcement-spacer { + border-left: 13rem solid var(--pst-color-background); } \ No newline at end of file From 77f7e2d6910f8909c19deb311887ed0e0a0da5d8 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Fri, 25 Nov 2022 16:08:00 +0100 Subject: [PATCH 02/21] Add announcent input --- doc/source/conf.py | 7 +++++-- src/ansys_sphinx_theme/announcement.html | 4 ++-- src/ansys_sphinx_theme/layout.html | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 50e95d57..38c222f1 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,6 +26,10 @@ release = version = __version__ cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com") +version_mapper = ( + "https://raw.githubusercontent.com/ansys/ansys-sphinx-theme/gh-pages/release/versions.json" +) + # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" @@ -52,9 +56,8 @@ }, ], "switcher": { - "json_url": f"https://{cname}/release/versions.json", + "json_url": version_mapper, "version_match": get_version_match(__version__), - "preferred": True, }, "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], } diff --git a/src/ansys_sphinx_theme/announcement.html b/src/ansys_sphinx_theme/announcement.html index 8c715131..9a09a073 100644 --- a/src/ansys_sphinx_theme/announcement.html +++ b/src/ansys_sphinx_theme/announcement.html @@ -1,9 +1,9 @@ -{% if theme_switcher and theme_switcher.get('preferred')== True %} +{% if theme_switcher %}
- {% include 'announcements.html' %} +
diff --git a/src/ansys_sphinx_theme/layout.html b/src/ansys_sphinx_theme/layout.html index 45860c10..980f0926 100644 --- a/src/ansys_sphinx_theme/layout.html +++ b/src/ansys_sphinx_theme/layout.html @@ -26,8 +26,8 @@ {% block extrahead %} - {{ super() }} {% include 'announcement.html' %} + {{ super() }} {% endblock %} {% block docs_navbar %} From 907e44cccf53035a82bd6e7784df963de1d92092 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Fri, 25 Nov 2022 17:07:16 +0100 Subject: [PATCH 03/21] Add js to dynamic insert of contents --- src/ansys_sphinx_theme/announcement.html | 10 +++++++++- src/ansys_sphinx_theme/static/css/breadcrumbs.css | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ansys_sphinx_theme/announcement.html b/src/ansys_sphinx_theme/announcement.html index 9a09a073..51ee61a2 100644 --- a/src/ansys_sphinx_theme/announcement.html +++ b/src/ansys_sphinx_theme/announcement.html @@ -3,7 +3,15 @@
- +

Fetch a file to change this text.

+
diff --git a/src/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/static/css/breadcrumbs.css index 7a695e23..4ac4ca24 100644 --- a/src/ansys_sphinx_theme/static/css/breadcrumbs.css +++ b/src/ansys_sphinx_theme/static/css/breadcrumbs.css @@ -25,6 +25,7 @@ body { #header-announcement{ background-color: blueviolet; + color:white } From 137120fd7132d7f3352c2a292bc2e30ecf32eda4 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Fri, 25 Nov 2022 18:21:02 +0100 Subject: [PATCH 04/21] Remove text --- src/ansys_sphinx_theme/announcement.html | 12 +++++------- src/ansys_sphinx_theme/static/css/breadcrumbs.css | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ansys_sphinx_theme/announcement.html b/src/ansys_sphinx_theme/announcement.html index 51ee61a2..860ce4a6 100644 --- a/src/ansys_sphinx_theme/announcement.html +++ b/src/ansys_sphinx_theme/announcement.html @@ -3,14 +3,12 @@
-

Fetch a file to change this text.

+

diff --git a/src/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/static/css/breadcrumbs.css index 4ac4ca24..7a695e23 100644 --- a/src/ansys_sphinx_theme/static/css/breadcrumbs.css +++ b/src/ansys_sphinx_theme/static/css/breadcrumbs.css @@ -25,7 +25,6 @@ body { #header-announcement{ background-color: blueviolet; - color:white } From e123107cfc218dd4fd373542a114235a0ec27b7d Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 28 Nov 2022 09:44:31 +0100 Subject: [PATCH 05/21] Rename announcement files --- src/ansys_sphinx_theme/announcement.html | 16 ---------------- src/ansys_sphinx_theme/layout.html | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 src/ansys_sphinx_theme/announcement.html diff --git a/src/ansys_sphinx_theme/announcement.html b/src/ansys_sphinx_theme/announcement.html deleted file mode 100644 index 860ce4a6..00000000 --- a/src/ansys_sphinx_theme/announcement.html +++ /dev/null @@ -1,16 +0,0 @@ -{% if theme_switcher %} -
-
-
-
-

- -
-
-
-{% endif %} diff --git a/src/ansys_sphinx_theme/layout.html b/src/ansys_sphinx_theme/layout.html index 980f0926..662d95a3 100644 --- a/src/ansys_sphinx_theme/layout.html +++ b/src/ansys_sphinx_theme/layout.html @@ -26,7 +26,7 @@ {% block extrahead %} - {% include 'announcement.html' %} + {% include 'announcement_layout.html' %} {{ super() }} {% endblock %} From bae995799aaa15ddab005a7f595c3425fe118cab Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 28 Nov 2022 09:49:59 +0100 Subject: [PATCH 06/21] Rename announcement file --- src/ansys_sphinx_theme/announcement_layout.html | 16 ++++++++++++++++ src/ansys_sphinx_theme/announcements.html | 1 - 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/ansys_sphinx_theme/announcement_layout.html delete mode 100644 src/ansys_sphinx_theme/announcements.html diff --git a/src/ansys_sphinx_theme/announcement_layout.html b/src/ansys_sphinx_theme/announcement_layout.html new file mode 100644 index 00000000..02d10a83 --- /dev/null +++ b/src/ansys_sphinx_theme/announcement_layout.html @@ -0,0 +1,16 @@ +{% if theme_switcher %} +
+
+
+
+

+ +
+
+
+{% endif %} \ No newline at end of file diff --git a/src/ansys_sphinx_theme/announcements.html b/src/ansys_sphinx_theme/announcements.html deleted file mode 100644 index 3bb786d7..00000000 --- a/src/ansys_sphinx_theme/announcements.html +++ /dev/null @@ -1 +0,0 @@ -

You are not reading the most recent version of this documentation. Latest stable release is 1.0

\ No newline at end of file From 119ba8c301a072a8a7446f65dc55179aa5f23b67 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 28 Nov 2022 09:53:41 +0100 Subject: [PATCH 07/21] Revert changes --- doc/source/conf.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 38c222f1..820de8e9 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,10 +26,6 @@ release = version = __version__ cname = os.getenv("DOCUMENTATION_CNAME", "nocname.com") -version_mapper = ( - "https://raw.githubusercontent.com/ansys/ansys-sphinx-theme/gh-pages/release/versions.json" -) - # use the default ansys logo html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" @@ -56,7 +52,7 @@ }, ], "switcher": { - "json_url": version_mapper, + "json_url": f"https://{cname}/release/versions.json", "version_match": get_version_match(__version__), }, "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], From 3f3c269142970c8ab6a5ccfd60522a439f33e633 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Mon, 28 Nov 2022 09:54:36 +0100 Subject: [PATCH 08/21] Read txt file --- src/ansys_sphinx_theme/announcement_layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys_sphinx_theme/announcement_layout.html b/src/ansys_sphinx_theme/announcement_layout.html index 02d10a83..0e73c71a 100644 --- a/src/ansys_sphinx_theme/announcement_layout.html +++ b/src/ansys_sphinx_theme/announcement_layout.html @@ -5,7 +5,7 @@

-
- - + {% endif %} \ No newline at end of file diff --git a/src/ansys_sphinx_theme/layout.html b/src/ansys_sphinx_theme/layout.html index 662d95a3..abc5e994 100644 --- a/src/ansys_sphinx_theme/layout.html +++ b/src/ansys_sphinx_theme/layout.html @@ -25,8 +25,11 @@ {% endblock %} -{% block extrahead %} - {% include 'announcement_layout.html' %} +{%- block content %} +
+ {% include 'announcement_layout.html' %} +
{{ super() }} {% endblock %} diff --git a/src/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/static/css/breadcrumbs.css index c922ca70..be6e217f 100644 --- a/src/ansys_sphinx_theme/static/css/breadcrumbs.css +++ b/src/ansys_sphinx_theme/static/css/breadcrumbs.css @@ -24,12 +24,12 @@ body { } #header-announcement{ - background-color: lightpink; + background-color: var(--pst-color-background); border: 1px solid black; - padding: 2px; margin-left: 20px solid var(--pst-color-background); margin-right: 20px solid var(--pst-color-background); padding-left: 3rem; + color: brown; } #header-announcement-spacer { From a599d17803517dd6243f56f98c54b17d3d5fd616 Mon Sep 17 00:00:00 2001 From: Jorge Martinez Garrido Date: Mon, 28 Nov 2022 20:48:29 +0100 Subject: [PATCH 12/21] DBG: check file present --- .../announcement_layout.html | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ansys_sphinx_theme/announcement_layout.html b/src/ansys_sphinx_theme/announcement_layout.html index 6c94a61f..9720d066 100644 --- a/src/ansys_sphinx_theme/announcement_layout.html +++ b/src/ansys_sphinx_theme/announcement_layout.html @@ -1,13 +1,14 @@ {% if theme_switcher %} +
-{% endif %} \ No newline at end of file +{% endif %} From c40e0c21e91767a047f6982cd6f06e69012ffe4b Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 29 Nov 2022 11:17:36 +0100 Subject: [PATCH 13/21] Add announcement message layout --- .../announcement_layout.html | 6 +-- src/ansys_sphinx_theme/layout.html | 9 +--- .../static/css/breadcrumbs.css | 41 ++++++++++++++----- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/ansys_sphinx_theme/announcement_layout.html b/src/ansys_sphinx_theme/announcement_layout.html index 9720d066..78a92163 100644 --- a/src/ansys_sphinx_theme/announcement_layout.html +++ b/src/ansys_sphinx_theme/announcement_layout.html @@ -1,14 +1,14 @@ {% if theme_switcher %} -
+
{% endif %} diff --git a/src/ansys_sphinx_theme/layout.html b/src/ansys_sphinx_theme/layout.html index abc5e994..22f92193 100644 --- a/src/ansys_sphinx_theme/layout.html +++ b/src/ansys_sphinx_theme/layout.html @@ -25,16 +25,9 @@ {% endblock %} -{%- block content %} -
- {% include 'announcement_layout.html' %} -
- {{ super() }} -{% endblock %} - {% block docs_navbar %} {{ super() }} + {% include 'announcement_layout.html' %} {% if theme_show_breadcrumbs %} {% include 'breadcrumbs.html' %} {% endif %} diff --git a/src/ansys_sphinx_theme/static/css/breadcrumbs.css b/src/ansys_sphinx_theme/static/css/breadcrumbs.css index be6e217f..a510491b 100644 --- a/src/ansys_sphinx_theme/static/css/breadcrumbs.css +++ b/src/ansys_sphinx_theme/static/css/breadcrumbs.css @@ -23,15 +23,36 @@ body { box-sizing: border-box; } -#header-announcement{ - background-color: var(--pst-color-background); - border: 1px solid black; - margin-left: 20px solid var(--pst-color-background); - margin-right: 20px solid var(--pst-color-background); - padding-left: 3rem; - color: brown; +#announcement_msg { + background-color: lightpink; + display: flex; + justify-content: center; + position: relative; + width: 100%; + padding: 0.5rem 12.5%; + text-align: center; +} + +#announcement_msg :after { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + background-color: var(--pst-color-info); + opacity: 0.2; + content: ""; + z-index: -1; } -#header-announcement-spacer { - padding-left: 10rem solid var(--pst-color-background); -} \ No newline at end of file +#announcement_msg :empty { + display: none; + } + +#announcement_msg p { + font-weight: bold; + margin: auto; + color:black; + } + + \ No newline at end of file From f074d8af7efe8115131884c547796b9389fdb052 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Tue, 29 Nov 2022 11:18:36 +0100 Subject: [PATCH 14/21] Revert the file name --- src/ansys_sphinx_theme/announcement_layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys_sphinx_theme/announcement_layout.html b/src/ansys_sphinx_theme/announcement_layout.html index 78a92163..96e868e8 100644 --- a/src/ansys_sphinx_theme/announcement_layout.html +++ b/src/ansys_sphinx_theme/announcement_layout.html @@ -1,7 +1,7 @@ {% if theme_switcher %}