From 43c75abee7f4e2c7a3371efafb13ca28de639eef Mon Sep 17 00:00:00 2001 From: John Wong Date: Tue, 24 May 2022 11:19:39 -0700 Subject: [PATCH 1/2] fix: Enable ability to exclude specific pages when survey is enabled --- README.rst | 1 + f5_sphinx_theme/__init__.py | 2 +- f5_sphinx_theme/layout.html | 7 ++++--- f5_sphinx_theme/theme.conf | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 4cca6e0..281615a 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,7 @@ Setup and Configuration # 'surveymonkey_url' = '', \\ DEFAULTS TO "" # 'medallia_embed_url' = '', \\ DEFAULTS TO "" # 'medallia_id' = '', \\ DEFAULTS TO "medallia_inline_survey" + # 'feedback_exclude_pages': ['page.html'], \\ DEFAULTS TO ['index.html', 'search.html'], THE TABLE OF CONTENTS AND SEARCH PAGE # 'base_url' = '' \\ DEFAULTS TO '/' } diff --git a/f5_sphinx_theme/__init__.py b/f5_sphinx_theme/__init__.py index 3ab6200..e4b0bbb 100644 --- a/f5_sphinx_theme/__init__.py +++ b/f5_sphinx_theme/__init__.py @@ -16,7 +16,7 @@ from os import path -__version__ = "2.2.0" +__version__ = "2.2.1" def get_html_theme_path(): diff --git a/f5_sphinx_theme/layout.html b/f5_sphinx_theme/layout.html index c745682..be25380 100644 --- a/f5_sphinx_theme/layout.html +++ b/f5_sphinx_theme/layout.html @@ -135,13 +135,13 @@
{{ project }} {{ version }}
{% endif %} - {% if theme_medallia_embed_url %} + {% if theme_medallia_embed_url and (pagename+file_suffix) not in theme_feedback_exclude_pages %}
{% endif %} - {% if theme_surveymonkey_url %} + {% if theme_surveymonkey_url and (pagename+file_suffix) not in theme_feedback_exclude_pages %}
Click here to provide feedback @@ -165,7 +165,8 @@
{{ project }} {{ version }}
{% if (theme_version_selector) %} {%- endif %} -{% if (theme_surveymonkey_url or theme_medallia_embed_url) %} +{% if (theme_surveymonkey_url or theme_medallia_embed_url) and (pagename+file_suffix) not in +theme_feedback_exclude_pages %} {%- endif %} diff --git a/f5_sphinx_theme/theme.conf b/f5_sphinx_theme/theme.conf index f389d1a..6f89321 100644 --- a/f5_sphinx_theme/theme.conf +++ b/f5_sphinx_theme/theme.conf @@ -11,3 +11,4 @@ enable_version_warning_banner = False surveymonkey_url = medallia_embed_url = medallia_id = medallia_inline_survey +feedback_exclude_pages = ['index.html', 'search.html'] From db5e9ea8c3097b08cb00b597993e89cb35838d04 Mon Sep 17 00:00:00 2001 From: John Wong Date: Tue, 24 May 2022 11:38:40 -0700 Subject: [PATCH 2/2] chore: removing js code that 'hides' SurveyMonkey which is no longer needed --- f5_sphinx_theme/static/js/feedback.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/f5_sphinx_theme/static/js/feedback.js b/f5_sphinx_theme/static/js/feedback.js index 10bf27b..6b6c76a 100644 --- a/f5_sphinx_theme/static/js/feedback.js +++ b/f5_sphinx_theme/static/js/feedback.js @@ -16,7 +16,6 @@ const surveyMonkeyAId = "survey-sm"; const surveyMonkeyUrlAttr = 'survey-sm-url'; const htmlString = ".html"; -const htmlDefaultIndex = "index.html"; // 'window' is a global variable. Define 'medalliaData' global variable here. var medalliaData = {}; @@ -49,16 +48,8 @@ function renderSM(smDiv) { const url = new URL(window.location.href); const urlPathNames = url.pathname.split('/').filter(Boolean); - // If this is an 'index.html' or isn't even an html page, hide the SurveyMonkey link. - if (url.pathname.trim().endsWith(htmlDefaultIndex) || !url.pathname.endsWith(htmlString)) { - console.debug('This page need to hide SurveyMonkey link') - // Hide the SurveyMonkey Div because this pages doesn't need it. - if (smDiv != null) { - $("#" + surveyMonkeyDivId).hide(); - } - } // Otherwise determine the custom variables for SurveyMonkey. - else if (urlPathNames[urlPathNames.length - 1].endsWith(htmlString)) { + if (urlPathNames[urlPathNames.length - 1].endsWith(htmlString)) { if (urlPathNames.length == 1) { surveyMonkey.searchParams.append(data.surveyMonkey.page, urlPathNames[urlPathNames.length - 1]); } else if (urlPathNames.length == 2) {