Skip to content

Commit

Permalink
Merge pull request #3810 from nationalarchives/TDRD-24-Add-Survey-Link
Browse files Browse the repository at this point in the history
Tdrd 24 add survey link
  • Loading branch information
Tom-Hallett authored Mar 27, 2024
2 parents d175335 + 373678e commit 9fa9512
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
17 changes: 13 additions & 4 deletions app/views/main.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* object to insert into the body of the page.
*@
@import views.html.helper.CSPNonce

@import views.html.partials.feedbackLink
@(title: String, hasError: Boolean = false, isLoggedIn: Boolean = true, name: String = "", isJudgmentUser: Boolean = false, backLink: Option[Html] = None)(content: Html)(implicit messages: Messages, request: RequestHeader)

<!DOCTYPE html>
Expand Down Expand Up @@ -85,9 +85,18 @@
<div class="govuk-phase-banner">
<p class="govuk-phase-banner__content">
<strong class="govuk-tag govuk-phase-banner__content__tag">BETA</strong>
<span class="govuk-phase-banner__text">This is a new service – your feedback will help us to improve it. Please
<a class="govuk-link" target="_blank" rel="noreferrer noopener" href="/contact">get in touch (opens in new tab).</a>
</span>
@if(isLoggedIn) {
@if(isJudgmentUser){
@feedbackLink("https://www.smartsurvey.co.uk/s/5YDPSA/")
}else{
@feedbackLink("https://www.smartsurvey.co.uk/s/tdr-feedback/")
}
}else {
<span class="govuk-phase-banner__text">
This is a new service – your feedback will help us to improve it. Please
<a class="govuk-link" target="_blank" rel="noreferrer noopener" href="/contact"> get in touch (opens in new tab).</a>
</span>
}
</p>
</div>
@backLink.getOrElse("")
Expand Down
6 changes: 6 additions & 0 deletions app/views/partials/feedbackLink.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@(surveyLink: String)

<span class="govuk-phase-banner__text">
This is a new service - your <a href="@surveyLink" class="govuk-link" rel="noreferrer noopener" target="_blank" title="What did you think of this service? (opens in new tab)">feedback</a> will help us to improve it.
</span>

2 changes: 0 additions & 2 deletions test/controllers/HomeControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class HomeControllerSpec extends FrontEndTestHelper {

private def checkForContentOnHomePage(pageAsString: String, signedIn: Boolean = true): Unit = {
pageAsString must include("<title>The National Archives - Transfer Digital Records - GOV.UK</title>")
pageAsString must include("This is a new service – your feedback will help us to improve it. Please")
pageAsString must include("href=\"/contact\">get in touch (opens in new tab).</a>")
pageAsString must include("Transfer Digital Records")
pageAsString must include("Use this service to:")
pageAsString must include("transfer digital records to The National Archives")
Expand Down
14 changes: 12 additions & 2 deletions test/testUtils/CheckPageForStaticElements.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class CheckPageForStaticElements() {
| <script src="/assets/javascripts/all.js" type="text/javascript"></script>
| <script src="/assets/javascripts/main.js" type="text/javascript"></script>""".stripMargin)
page must include("""<a href="#main-content" class="govuk-skip-link" data-module="govuk-skip-link">Skip to main content</a>""")
page must include("This is a new service – your feedback will help us to improve it. Please")
page must include("href=\"/contact\">get in touch (opens in new tab).</a>")
page must include("""href="/contact">""")
page must include("""href="/cookies">""")
page must include("""href="/accessibility-statement">""")
Expand All @@ -34,6 +32,8 @@ class CheckPageForStaticElements() {
if (signedIn) {
checkContentOfSignedInPagesThatUseMainScala(page, userType, consignmentExists, transferStillInProgress, pageRequiresAwsServices)
} else {
page must include("This is a new service – your feedback will help us to improve it. Please")
page must include("""href="/contact"> get in touch (opens in new tab).</a>""")
page must not include "/faq"
page must not include "Sign out"
}
Expand Down Expand Up @@ -65,6 +65,7 @@ class CheckPageForStaticElements() {
| </div>
| </dialog>""".stripMargin)
if (userType == "judgment") {
checkHeaderOfSignedInPagesForFeedbackLink(page, survey = "5YDPSA")
page must not include ("View transfers")
page must include("""href="/judgment/faq">""")
page must include("""href="/judgment/help">""")
Expand All @@ -77,6 +78,7 @@ class CheckPageForStaticElements() {
}
}
} else if (userType == "standard") {
checkHeaderOfSignedInPagesForFeedbackLink(page)
page must include("View transfers")
page must include("""href="/faq">""")
page must include("""href="/help">""")
Expand All @@ -97,5 +99,13 @@ class CheckPageForStaticElements() {
)
}
}

private def checkHeaderOfSignedInPagesForFeedbackLink(page: String, survey: String = "tdr-feedback") = {
page must include(
s"""<span class="govuk-phase-banner__text">
| This is a new service - your <a href="https://www.smartsurvey.co.uk/s/$survey/" class="govuk-link" rel="noreferrer noopener" target="_blank" title="What did you think of this service? (opens in new tab)">feedback</a> will help us to improve it.
|</span>""".stripMargin
)
}
// scalastyle:on method.length
}

0 comments on commit 9fa9512

Please sign in to comment.