Skip to content

Commit 1b4c991

Browse files
author
Jacek Gębal
committed
Adding feedback form.
1 parent 0b02906 commit 1b4c991

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

docs/assets/topbar.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@
258258
});
259259
}
260260

261+
function rewriteFeedbackLink() {
262+
var title = encodeURIComponent('Doc feedback: ' + document.title);
263+
var body = encodeURIComponent('Page: ' + location.href + '\n\nWhat could be improved:\n');
264+
document.querySelectorAll('.md-feedback a[href*="discussions/new"]').forEach(function (a) {
265+
a.href = 'https://github.com/utPLSQL/utPLSQL/discussions/new?category=documentation-feedback&title=' + title + '&body=' + body;
266+
});
267+
}
268+
261269
/* Hide Material's built-in header controls immediately to prevent a flash
262270
where logo/palette appear before the topbar is painted. */
263271
ensureStyle();
@@ -273,14 +281,16 @@
273281
applyScheme(effectiveScheme(getPreference()));
274282

275283
if (document.readyState === 'loading') {
276-
document.addEventListener('DOMContentLoaded', inject);
284+
document.addEventListener('DOMContentLoaded', function () { inject(); rewriteFeedbackLink(); });
277285
} else {
278286
inject();
287+
rewriteFeedbackLink();
279288
}
280289

281290
/* Material instant navigation — fires after each page swap. */
282291
if (typeof document$ !== 'undefined') {
283292
document$.subscribe(inject);
293+
document$.subscribe(rewriteFeedbackLink);
284294
}
285295
/* Fallback: browser history navigation */
286296
window.addEventListener('popstate', updateActiveLink);

mkdocs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ extra:
4848
analytics:
4949
provider: google
5050
property: G-WMFVR98J0Q
51+
feedback:
52+
title: Was this page helpful?
53+
ratings:
54+
- icon: material/emoticon-happy-outline
55+
name: This page was helpful
56+
data: 1
57+
note: >-
58+
Thanks for your feedback!
59+
- icon: material/emoticon-sad-outline
60+
name: This page could be improved
61+
data: 0
62+
note: >-
63+
Thanks for your feedback! Help us improve this page by
64+
using our <a href="https://github.com/utPLSQL/utPLSQL/discussions/new?category=documentation-feedback" target="_blank" rel="noopener noreferrer">GitHub Discussions</a>.
5165
social:
5266
- icon: fontawesome/brands/twitter
5367
link: https://twitter.com/utPLSQL

0 commit comments

Comments
 (0)