From b7d30ef8e0fede698a3c1b45d633a73ba9f058ed Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Fri, 9 Aug 2024 14:20:01 +0100 Subject: [PATCH 1/5] feature: add feedback banner to all pages --- .../Views/Shared/_Content.cshtml | 3 +- .../Views/Shared/_Feedback.cshtml | 18 +++++++++ .../wwwroot/css/cands-site.css | 37 +++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml index 0aeafcd..aedcd0d 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml @@ -6,4 +6,5 @@ var richText = Model as RichTextContentItem; } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml new file mode 100644 index 0000000..d00fecc --- /dev/null +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml @@ -0,0 +1,18 @@ +
+
+
+
+
+

Is this page + useful?

+
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css b/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css index f66be84..dd61433 100644 --- a/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css +++ b/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css @@ -84,6 +84,43 @@ video { background-color: #ebf2f6; } +.dfe-feedback-banner { + background-color: #f3f2f1; + border: 1px solid #b1b4b6; + margin-bottom: 30px; + } + + .dfe-feedback-banner--content { + padding: 20px 15px; + display: block; + line-height: 1.333; + } + + .dfe-feedback-banner--content-questions { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + } + + .dfe-feedback-banner--content-question { + display: flex; + align-items: center; + } + + .dfe-feedback-banner + .govuk-button, + .dfe-feedback-banner + .govuk-button-group { + margin-bottom: 0; + } + + .dfe-feedback-banner--content-question + .dfe-feedback-banner--content-question-text { + margin-bottom: 0; + margin-right: 20px; + } + .guidance-container { border: 1px solid #b1b4b6; } From 2e2129236e6a2dc9cf839ae28dd2c069f0ebbc57 Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Tue, 13 Aug 2024 09:30:01 +0100 Subject: [PATCH 2/5] add thankyou message to feedback banner --- .../Views/Shared/_Feedback.cshtml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml index d00fecc..12e423b 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml @@ -7,12 +7,22 @@ useful?
+ data-module="govuk-button" onclick="handleFeedback('Yes')">Yes + data-module="govuk-button" onclick="handleFeedback('No')">No
+ - \ No newline at end of file + + + \ No newline at end of file From c562af168e1662066d89cdfda9b4996a04d9d79d Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Tue, 13 Aug 2024 10:53:51 +0100 Subject: [PATCH 3/5] feat: render or hide feedback banner based on contentful boolean --- src/Dfe.ContentSupport.Web/Models/Mapped/CsPage.cs | 1 + src/Dfe.ContentSupport.Web/Services/ModelMapper.cs | 1 + src/Dfe.ContentSupport.Web/ViewModels/ContentSupportPage.cs | 1 + src/Dfe.ContentSupport.Web/Views/Content/CsIndex.cshtml | 5 +++++ src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml | 3 +-- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Dfe.ContentSupport.Web/Models/Mapped/CsPage.cs b/src/Dfe.ContentSupport.Web/Models/Mapped/CsPage.cs index 2017016..e933fee 100644 --- a/src/Dfe.ContentSupport.Web/Models/Mapped/CsPage.cs +++ b/src/Dfe.ContentSupport.Web/Models/Mapped/CsPage.cs @@ -13,4 +13,5 @@ public class CsPage public List Content { get; set; } = null!; public DateTime? CreatedAt { get; init; } public DateTime? UpdatedAt { get; init; } + public bool HasFeedbackBanner { get; set; } } \ No newline at end of file diff --git a/src/Dfe.ContentSupport.Web/Services/ModelMapper.cs b/src/Dfe.ContentSupport.Web/Services/ModelMapper.cs index a9b8262..c8d4bef 100644 --- a/src/Dfe.ContentSupport.Web/Services/ModelMapper.cs +++ b/src/Dfe.ContentSupport.Web/Services/ModelMapper.cs @@ -25,6 +25,7 @@ public CsPage MapToCsPage(ContentSupportPage incoming) IsSitemap = incoming.IsSitemap, HasCitation = incoming.HasCitation, HasBackToTop = incoming.HasBackToTop, + HasFeedbackBanner = incoming.HasFeedbackBanner, Content = MapEntriesToContent(incoming.Content), CreatedAt = incoming.Sys.CreatedAt, UpdatedAt = incoming.Sys.UpdatedAt diff --git a/src/Dfe.ContentSupport.Web/ViewModels/ContentSupportPage.cs b/src/Dfe.ContentSupport.Web/ViewModels/ContentSupportPage.cs index 90b0f42..6b6cf1d 100644 --- a/src/Dfe.ContentSupport.Web/ViewModels/ContentSupportPage.cs +++ b/src/Dfe.ContentSupport.Web/ViewModels/ContentSupportPage.cs @@ -17,4 +17,5 @@ public class ContentSupportPage : ContentBase public bool IsSitemap { get; init; } public bool HasCitation { get; init; } public bool HasBackToTop { get; init; } + public bool HasFeedbackBanner { get; init; } } \ No newline at end of file diff --git a/src/Dfe.ContentSupport.Web/Views/Content/CsIndex.cshtml b/src/Dfe.ContentSupport.Web/Views/Content/CsIndex.cshtml index 940966e..7a91cdd 100644 --- a/src/Dfe.ContentSupport.Web/Views/Content/CsIndex.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Content/CsIndex.cshtml @@ -21,5 +21,10 @@ { } + + @if (Model.HasFeedbackBanner) + { + + } \ No newline at end of file diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml index aedcd0d..0aeafcd 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_Content.cshtml @@ -6,5 +6,4 @@ var richText = Model as RichTextContentItem; } -} - \ No newline at end of file +} \ No newline at end of file From 8aa8ada11cde30e8e245600dccad75a988762691 Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Tue, 13 Aug 2024 16:31:34 +0100 Subject: [PATCH 4/5] wip: reenable content cookies to test conditional rendering for feedback banner --- .../Views/Shared/_CsLayout.cshtml | 7 ++++--- .../Views/Shared/_Feedback.cshtml | 10 +++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml index d4a3147..338bc4e 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml @@ -7,7 +7,8 @@ ViewData["Title"] = Model.Heading.Title; ViewData["containerClasses"] = "dfe-width-container"; var consentCookie = Context.Request.Cookies[".AspNet.Consent"]; - var track = false;// consentCookie == "true"; + @* var track = false; *@ + var track = consentCookie == "true"; } @section Head { @@ -32,9 +33,9 @@
- @* + - *@ +
diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml index 12e423b..09a9d3f 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_Feedback.cshtml @@ -1,3 +1,10 @@ +@{ + var consentCookie = Context.Request.Cookies[".AspNet.Consent"]; + var track = consentCookie == "true"; +} + +@if (track) +{
@@ -25,4 +32,5 @@ document.getElementById('questionForm').style.display = 'none'; document.getElementById('feedbackMessage').style.display = 'block'; } - \ No newline at end of file + +} \ No newline at end of file From 286c2dd269fa2e64cdf88346f7081a9fd5b42201 Mon Sep 17 00:00:00 2001 From: "jack.coggin" Date: Thu, 15 Aug 2024 09:58:06 +0100 Subject: [PATCH 5/5] remove comment --- src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml b/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml index 338bc4e..fa842bf 100644 --- a/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml +++ b/src/Dfe.ContentSupport.Web/Views/Shared/_CsLayout.cshtml @@ -7,7 +7,6 @@ ViewData["Title"] = Model.Heading.Title; ViewData["containerClasses"] = "dfe-width-container"; var consentCookie = Context.Request.Cookies[".AspNet.Consent"]; - @* var track = false; *@ var track = consentCookie == "true"; } @@ -33,9 +32,7 @@
- -