diff --git a/i18n/en.toml b/i18n/en.toml index 4b95b73749..a206ba3160 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -274,6 +274,15 @@ other = "Yes" [feedback_no] other = "No" +[feedback_ask_for_comment] +other = "Do you have any suggestions for improvement?" + +[feedback_thankyou] +other = "Thanks for your feedback!" + +[feedback_comment_placeholder] +other = "Help us improve..." + [log_month_format] other = "January 2006" diff --git a/layouts/_default/security-grid.html b/layouts/_default/security-grid.html index aef87ee758..5b788115b2 100644 --- a/layouts/_default/security-grid.html +++ b/layouts/_default/security-grid.html @@ -47,15 +47,7 @@ {{ end }} - {{ if .Params.cves }} - - {{ range $cve := .Params.cves }} - {{ $cve}}
- {{ end }} - - {{ else }} - {{ trim .Description "." -}} - {{ end }} + {{ trim .Description "." -}} {{ end }} {{ end }} diff --git a/layouts/partials/primary_bottom.html b/layouts/partials/primary_bottom.html index d0b16e0efb..e2bfc9bb55 100644 --- a/layouts/partials/primary_bottom.html +++ b/layouts/partials/primary_bottom.html @@ -37,11 +37,18 @@ {{ if .Scratch.Get "getFeedback" }}
-
+
{{ i18n "feedback_title" }}
+
+ {{ i18n "feedback_ask_for_comment" }}
+ +
+
+ {{ i18n "feedback_thankyou" }} +
{{ end }} diff --git a/src/sass/misc/_feedback.scss b/src/sass/misc/_feedback.scss index 32a925ad6c..b8809cedc7 100644 --- a/src/sass/misc/_feedback.scss +++ b/src/sass/misc/_feedback.scss @@ -27,4 +27,12 @@ color: $textBrandColor; cursor: default; } + + #feedback-comment { + display: none; + } + + #feedback-thankyou { + display: none; + } } diff --git a/src/ts/feedback.ts b/src/ts/feedback.ts index 8ffc8d28c8..67454003ee 100644 --- a/src/ts/feedback.ts +++ b/src/ts/feedback.ts @@ -21,7 +21,36 @@ function sendFeedback(language: string, value: number): void { value, }); - document.querySelectorAll(".feedback").forEach(button => { - button.disabled = true; - }); + const initial = getById("feedback-initial"); + if (initial) { + initial.style.display = "none"; + } + + let next = "feedback-thankyou"; + if (value === 0) { + next = "feedback-comment"; + } + + const ne = getById(next); + if (ne) { + ne.style.display = "block"; + } +} + +function sendComment(language: string, value: string): void { + gtag("event", "comment-" + language, { + event_category: "Helpful", + event_label: window.location.pathname, + value, + }); + + const comment = getById("feedback-comment"); + if (comment) { + comment.style.display = "none"; + } + + const ty = getById("feedback-thankyou"); + if (ty) { + ty.style.display = "block"; + } }