From fdbd14870ea3fe9b4918b4f64ae5078c72ab8d47 Mon Sep 17 00:00:00 2001 From: Anastasia Alexandrova Date: Thu, 28 Sep 2023 13:32:17 +0200 Subject: [PATCH] PBM-908 Added the feedback form (#88) PBM-908 Added the feedback form Changed Analytics setup, moved nav customization to main.html --- _resource/.icons/percona/logo.svg | 3 + _resource/overrides/main.html | 97 ++++++++-------------- _resource/overrides/partials/nav.html | 36 -------- _resource/overrides/partials/toc-item.html | 22 ----- docs/css/percona.css | 64 +++++++++++++- docs/js/feedback.js | 11 +++ mkdocs-base.yml | 10 ++- mkdocs.yml | 27 +++++- snippets/services-banner.md | 16 ++++ 9 files changed, 159 insertions(+), 127 deletions(-) create mode 100644 _resource/.icons/percona/logo.svg delete mode 100644 _resource/overrides/partials/nav.html delete mode 100644 _resource/overrides/partials/toc-item.html create mode 100644 docs/js/feedback.js create mode 100644 snippets/services-banner.md diff --git a/_resource/.icons/percona/logo.svg b/_resource/.icons/percona/logo.svg new file mode 100644 index 00000000..6bb15edb --- /dev/null +++ b/_resource/.icons/percona/logo.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_resource/overrides/main.html b/_resource/overrides/main.html index 83cdc61b..4659447e 100644 --- a/_resource/overrides/main.html +++ b/_resource/overrides/main.html @@ -36,68 +36,37 @@

Contact Us

- {% endblock %} - - - {% block analytics %} - - - - - - - - {% endblock %} - - {% block content %} - - - {% if page.edit_url %} - {% set edit = "https://github.com/percona/pbm-docs/edit/main/docs/" %} - {% set view = "https://raw.githubusercontent.com/percona/pbm-docs/main/docs/" %} - - {% include ".icons/material/file-edit-outline.svg" %} - - - {% include ".icons/material/file-eye-outline.svg" %} - - {% endif %} - - - {% if "\x3ch1" not in page.content %} -

{{ page.title | d(config.site_name, true)}}

- {% endif %} - - - {{ page.content }} - - {{ relbar2() }} - - - {% if page and page.meta %} - {% if page.meta.git_revision_date_localized or - page.meta.revision_date - %} - {% include "partials/source-file.html" %} - {% endif %} - {% endif %} - {% endblock %} - + {% endblock %} + {% block site_nav %} + {% if nav %} + {% if page.meta and page.meta.hide %} + {% set hidden = "hidden" if "navigation" in page.meta.hide %} + {% endif %} + + {% endif %} + {% if "toc.integrate" not in features %} + {% if page.meta and page.meta.hide %} + {% set hidden = "hidden" if "toc" in page.meta.hide %} + {% endif %} + + {% endif %} + {% endblock %} diff --git a/_resource/overrides/partials/nav.html b/_resource/overrides/partials/nav.html deleted file mode 100644 index 9ad0eeca..00000000 --- a/_resource/overrides/partials/nav.html +++ /dev/null @@ -1,36 +0,0 @@ -{#- - This file was automatically generated - do not edit --#} -{% import "partials/nav-item.html" as item with context %} -{% set class = "md-nav md-nav--primary" %} -{% if "navigation.tabs" in features %} - {% set class = class ~ " md-nav--lifted" %} -{% endif %} -{% if "toc.integrate" in features %} - {% set class = class ~ " md-nav--integrated" %} -{% endif %} - diff --git a/_resource/overrides/partials/toc-item.html b/_resource/overrides/partials/toc-item.html deleted file mode 100644 index 0854ca67..00000000 --- a/_resource/overrides/partials/toc-item.html +++ /dev/null @@ -1,22 +0,0 @@ - -
  • - - {{ toc_item.title }} - - - - {% if toc_item.children %} - - {% endif %} - - {% if not page.meta.toc_depth or toc_item.level <= page.meta.toc_depth %} -
  • -
  • - {% endif %} - \ No newline at end of file diff --git a/docs/css/percona.css b/docs/css/percona.css index a84dd580..0d2462ac 100644 --- a/docs/css/percona.css +++ b/docs/css/percona.css @@ -64,7 +64,69 @@ margin: 1em 0 .54em; color:var(--md-accent-bg-color) } - +/* Custom Banner */ +[data-banner] { + padding: 1.5em; + margin: 2em 0; + border: 0.05rem solid var(--md-default-fg-color--lighter); + /* border: 0.05rem solid var(--md-typeset-table-color); */ + border-radius: 0.2rem; +} +[data-banner] .title { + font-weight: normal; + margin: 0; +} +[data-banner] > :last-child { + margin-bottom: 0; +} +[data-banner] a:link { + font-weight: bold; +} +[data-banner] .actions > p { + margin: 0; +} +[data-banner] .actions a { + display: inline-block; + margin: 0.5em 1.5em 0 0; +} +[data-banner] > :only-child, +[data-banner] .actions a:first-of-type { + margin-top: 0; +} +[data-banner] a [class*="moji"] { + height: 1.3333em; + vertical-align: -0.3333em; +} +[data-banner] a [class*="moji"] svg { + width: 1.3333em; +} +[data-grid] { + display: flex; + flex-wrap: wrap; + margin-right: -1rem; +} +[data-grid] [data-banner] { + flex: 1 1 320px; + display: flex; + flex-direction: column; + margin: 0 1rem 1rem 0; +} +[data-grid] .title { + font-size: 0.8rem; + font-weight: bold; +} +[data-grid] [data-banner] > p:last-child { + margin-top: 0; +} +[data-grid] [data-banner] > p:nth-last-child(2) { + flex-grow: 2; +} +[data-grid] + [data-banner] { + margin-top: 0; +} +[data-grid] .md-button { + margin: 0.5em 0.25em 0 0; +} /*.git-revision-date-localized-plugin:before { content: url('https://api.iconify.design/mdi/clock-edit-outline.svg'); diff --git a/docs/js/feedback.js b/docs/js/feedback.js new file mode 100644 index 00000000..fcf4709a --- /dev/null +++ b/docs/js/feedback.js @@ -0,0 +1,11 @@ +var feedback = document.forms.feedback +feedback.addEventListener("submit", function(ev) { + ev.preventDefault() + + /* Retrieve page and feedback value */ + var page = document.location.pathname + var data = ev.submitter.getAttribute("data-md-value") + + /* Send feedback value */ + console.log(page, data) +}) diff --git a/mkdocs-base.yml b/mkdocs-base.yml index 7c4d0984..73b9cd93 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -46,6 +46,7 @@ extra_css: extra_javascript: - js/promptremover.js + - js/feedback.js markdown_extensions: abbr: {} @@ -75,10 +76,16 @@ markdown_extensions: pymdownx.highlight: linenums: false pymdownx.inlinehilite: {} - pymdownx.snippets: {} + pymdownx.snippets: + base_path: ["snippets"] + auto_append: + - services-banner.md pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg + options: + custom_icons: + - _resource/.icons #Mkdocs plugins plugins: @@ -127,6 +134,7 @@ extra: find what they're searching for. With your consent, you're helping us to make our documentation better. Read more about Percona Cookie Policy. + nav: - Home: index.md - Release notes: diff --git a/mkdocs.yml b/mkdocs.yml index b8eb362b..1a59c5d5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -13,6 +13,7 @@ theme: features: - search.highlight + - search.share - navigation.top - navigation.tracking - content.tabs.link @@ -24,10 +25,30 @@ plugins: section-index: {} #Google Analytics configuration -extra: - analytics: +extra: + analytics: provider: google - property: UA-343802-3 + property: !ENV GOOGLE_ANALYTICS_KEY + feedback: + title: Was this page helpful? + ratings: + - icon: material/emoticon-happy-outline + name: This page was helpful + data: 1 + note: >- + Thanks for your feedback! + - icon: material/emoticon-sad-outline + name: This page could be improved + data: 0 + note: >- + Thank you for your feedback! Help us improve by using our + + feedback form. + +# note: >- +# Thanks for your feedback! Help us improve this page by +# using our feedback form. + #Feedback form widget # feedback: diff --git a/snippets/services-banner.md b/snippets/services-banner.md new file mode 100644 index 00000000..af02d26c --- /dev/null +++ b/snippets/services-banner.md @@ -0,0 +1,16 @@ + + +
    + +## Get expert help { .title } + +If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. + +
    + +[:material-forum-outline: Community Forum](https://forums.percona.com/c/mongodb/percona-backup-for-mongodb/22?utm_campaign=Doc%20pages) [:percona-logo: Get a Percona Expert](https://www.percona.com/about/contact) + +
    + +
    +