Skip to content

Commit

Permalink
Merge pull request #4048 from nationalarchives/TDRD-394-Update-Downlo…
Browse files Browse the repository at this point in the history
…ad-Text

Tdrd 394 update download text
  • Loading branch information
Tom-Hallett authored Jul 24, 2024
2 parents 3024ac1 + 10ac818 commit fb7f8d0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 31 deletions.
10 changes: 1 addition & 9 deletions app/views/draftmetadata/draftMetadataUpload.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@ <h1 class="govuk-heading-l">Upload a metadata CSV</h1>
<p>In your CSV, include a header row for the column titles and one row for every record that requires metadata.</p>
</div>
<div>
<a class="govuk-button govuk-!-margin-bottom-8 download-metadata" href="/consignment/@consignmentId/additional-metadata/download-metadata/csv">
<span aria-hidden="true" class="tna-button-icon">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 21">
<path fill="#fff" d="M15.96 21V2.52h-1.68v16.8H2.52V21h13.44Z"></path>
<path fill="#fff" d="M0 0h13.44v18.48H0z"></path>
</svg>
</span>
Download metadata Excel template
</a>
@downloadMetadataLink(consignmentId, "Download metadata Excel template")
</div>

<div class="govuk-form-group">
Expand Down
6 changes: 3 additions & 3 deletions app/views/standard/transferComplete.scala.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import views.html.partials.{feedbackSurvey, returnToHomepage}

@import views.html.partials.{feedbackSurvey, returnToHomepage, downloadMetadataLink}
@import java.util.UUID

@(consignmentId: UUID, consignmentReference: String, name: String)(implicit messages: Messages, request: RequestHeader)
@main("Transfer complete", name = name) {
@defining(play.core.PlayVersion.current) { version =>
Expand All @@ -22,7 +22,7 @@ <h1 class="govuk-panel__title">
<p class="govuk-body">Your records are not yet preserved so you must not delete the original records.</p>

<p class="govuk-body">
Download a <a href="@routes.DownloadMetadataController.downloadMetadataFile(consignmentId)">CSV of your records and metadata</a>.
@downloadMetadataLink(consignmentId)
</p>

<h2 class="govuk-heading-m govuk-!-margin-top-2">What happens next</h2>
Expand Down
5 changes: 2 additions & 3 deletions app/views/tna/metadataReviewAction.scala.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import controllers.util.DropdownField
@import graphql.codegen.GetConsignmentDetailsForMetadataReview.{getConsignmentDetailsForMetadataReview => gcdfmr}
@import helper._
@import views.html.partials.{backLink, errorSummary, inputDropdown}
@import views.html.partials.{backLink, errorSummary, inputDropdown, downloadMetadataLink}

@import java.util.UUID
@(consignmentId: UUID, consignmentDetails: gcdfmr.GetConsignment, dropdownField: DropdownField)(implicit request: RequestHeader, messages: Messages)
Expand Down Expand Up @@ -53,8 +53,7 @@ <h2 class="govuk-label-wrapper">
</label>
</h2>

<a id="download-metadata" class="govuk-button govuk-button--secondary" href="/consignment/@consignmentId/additional-metadata/download-metadata/csv">
Download Metadata</a>
@downloadMetadataLink(consignmentId)

<h2 class="govuk-label-wrapper">
<label class="govuk-label govuk-label--m">
Expand Down
18 changes: 14 additions & 4 deletions test/controllers/MetadataReviewActionControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ class MetadataReviewActionControllerSpec extends FrontEndTestHelper {
| $userId
| </dd>""".stripMargin)
pageAsString must include("""1. Download and review transfer metadata""")
pageAsString must include(
s"""<a id="download-metadata" class="govuk-button govuk-button--secondary" href="/consignment/$consignmentId/additional-metadata/download-metadata/csv">
| Download Metadata</a>""".stripMargin
)
pageAsString must include(downloadLinkHTML(consignmentId))
pageAsString must include("""2. Set the status of this review""")
pageAsString must include(s"""<form action="/admin/metadata-review/$consignmentId?consignmentRef=TDR-2024-TEST" method="POST" novalidate="">""")
pageAsString must include(s"""<option value="" selected>
Expand All @@ -192,4 +189,17 @@ class MetadataReviewActionControllerSpec extends FrontEndTestHelper {
pageAsString must include(s"""<option value="Completed">Approve</option>""")
pageAsString must include(s"""<option value="CompletedWithIssues">Reject</option>""")
}

private def downloadLinkHTML(consignmentId: UUID): String = {
val linkHTML: String = s"""<a class="govuk-button govuk-button--secondary govuk-!-margin-bottom-8 download-metadata" href="/consignment/$consignmentId/additional-metadata/download-metadata/csv">
| <span aria-hidden="true" class="tna-button-icon">
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 23 23">
| <path fill="#020202" d="m11.5 16.75-6.563-6.563 1.838-1.903 3.412 3.413V1h2.626v10.697l3.412-3.413 1.837 1.903L11.5 16.75ZM3.625 22c-.722 0-1.34-.257-1.853-.77A2.533 2.533 0 0 1 1 19.375v-3.938h2.625v3.938h15.75v-3.938H22v3.938c0 .722-.257 1.34-.77 1.855a2.522 2.522 0 0 1-1.855.77H3.625Z"></path>
| </svg>
| </span>
| Download metadata
|</a>
|""".stripMargin
linkHTML
}
}
26 changes: 14 additions & 12 deletions test/controllers/TransferCompleteControllerSpec.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package controllers

import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock.{containing, okJson, post, urlEqualTo}
import configuration.GraphQLConfiguration
import graphql.codegen.GetConsignmentExport.getConsignmentForExport.GetConsignment
import graphql.codegen.GetConsignmentExport.getConsignmentForExport.GetConsignment.Files
import graphql.codegen.GetConsignmentExport.{getConsignmentForExport => gcfe}
import io.circe.Printer
import io.circe.generic.auto._
import io.circe.syntax._
import org.pac4j.play.scala.SecurityComponents
import play.api.http.Status.FORBIDDEN
import play.api.mvc.Result
Expand Down Expand Up @@ -63,11 +56,7 @@ class TransferCompleteControllerSpec extends FrontEndTestHelper {
transferCompletePageAsString must include(
"""<p class="govuk-body">Your records are not yet preserved so you must not delete the original records.</p>""".stripMargin
)
transferCompletePageAsString must include(
s"""<p class="govuk-body">
| Download a <a href="/consignment/$consignmentId/additional-metadata/download-metadata/csv">CSV of your records and metadata</a>.
| </p>""".stripMargin
)
transferCompletePageAsString must include(downloadLinkHTML(consignmentId))
transferCompletePageAsString must include(
"""<p class="govuk-body">We will contact you via email within 90 days. If you do not receive an email, contact <a href="mailto:nationalArchives.email">nationalArchives.email</a>.</p>"""
)
Expand Down Expand Up @@ -190,4 +179,17 @@ class TransferCompleteControllerSpec extends FrontEndTestHelper {
| </a>""".stripMargin
)
}

private def downloadLinkHTML(consignmentId: UUID): String = {
val linkHTML: String = s"""<a class="govuk-button govuk-button--secondary govuk-!-margin-bottom-8 download-metadata" href="/consignment/$consignmentId/additional-metadata/download-metadata/csv">
| <span aria-hidden="true" class="tna-button-icon">
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 23 23">
| <path fill="#020202" d="m11.5 16.75-6.563-6.563 1.838-1.903 3.412 3.413V1h2.626v10.697l3.412-3.413 1.837 1.903L11.5 16.75ZM3.625 22c-.722 0-1.34-.257-1.853-.77A2.533 2.533 0 0 1 1 19.375v-3.938h2.625v3.938h15.75v-3.938H22v3.938c0 .722-.257 1.34-.77 1.855a2.522 2.522 0 0 1-1.855.77H3.625Z"></path>
| </svg>
| </span>
| Download metadata
|</a>
|""".stripMargin
linkHTML
}
}

0 comments on commit fb7f8d0

Please sign in to comment.