From 9c6b125549fb5ec721aea07c5e93defb773781bb Mon Sep 17 00:00:00 2001 From: yasaracar <9132533+yasaracar@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:59:11 +0000 Subject: [PATCH 1/9] ADR-743 Initial page creation --- app/controllers/ProductNameController.scala | 71 ++++++++ app/forms/ProductNameFormProvider.scala | 31 ++++ app/pages/ProductNamePage.scala | 26 +++ .../checkAnswers/ProductNameSummary.scala | 43 +++++ app/views/ProductNameView.scala.html | 49 ++++++ conf/app.routes | 5 + conf/messages.en | 9 +- .../ProductNameControllerSpec.scala | 160 ++++++++++++++++++ test/forms/ProductNameFormProviderSpec.scala | 53 ++++++ 9 files changed, 446 insertions(+), 1 deletion(-) create mode 100644 app/controllers/ProductNameController.scala create mode 100644 app/forms/ProductNameFormProvider.scala create mode 100644 app/pages/ProductNamePage.scala create mode 100644 app/viewmodels/checkAnswers/ProductNameSummary.scala create mode 100644 app/views/ProductNameView.scala.html create mode 100644 test/controllers/ProductNameControllerSpec.scala create mode 100644 test/forms/ProductNameFormProviderSpec.scala diff --git a/app/controllers/ProductNameController.scala b/app/controllers/ProductNameController.scala new file mode 100644 index 00000000..afca491a --- /dev/null +++ b/app/controllers/ProductNameController.scala @@ -0,0 +1,71 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package controllers + +import connectors.CacheConnector +import controllers.actions._ +import forms.ProductNameFormProvider + +import javax.inject.Inject +import models.{Mode, UserAnswers} +import navigation.Navigator +import pages.ProductNamePage +import play.api.i18n.{I18nSupport, MessagesApi} +import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} +import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController +import views.html.ProductNameView + +import scala.concurrent.{ExecutionContext, Future} + +class ProductNameController @Inject() ( + override val messagesApi: MessagesApi, + cacheConnector: CacheConnector, + navigator: Navigator, + identify: IdentifierAction, + getData: DataRetrievalAction, + formProvider: ProductNameFormProvider, + val controllerComponents: MessagesControllerComponents, + view: ProductNameView +)(implicit ec: ExecutionContext) + extends FrontendBaseController + with I18nSupport { + + val form = formProvider() + + def onPageLoad(mode: Mode): Action[AnyContent] = (identify andThen getData) { implicit request => + val preparedForm = request.userAnswers.flatMap(_.get(ProductNamePage)) match { + case None => form + case Some(value) => form.fill(value) + } + + Ok(view(preparedForm, mode)) + } + + def onSubmit(mode: Mode): Action[AnyContent] = (identify andThen getData).async { implicit request => + form + .bindFromRequest() + .fold( + formWithErrors => Future.successful(BadRequest(view(formWithErrors, mode))), + value => + for { + updatedAnswers <- + Future.fromTry(request.userAnswers.getOrElse(UserAnswers(request.userId)).set(ProductNamePage, value)) + _ <- cacheConnector.set(updatedAnswers) + } yield Redirect(navigator.nextPage(ProductNamePage, mode, updatedAnswers)) + ) + } +} diff --git a/app/forms/ProductNameFormProvider.scala b/app/forms/ProductNameFormProvider.scala new file mode 100644 index 00000000..c75451f8 --- /dev/null +++ b/app/forms/ProductNameFormProvider.scala @@ -0,0 +1,31 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package forms + +import javax.inject.Inject + +import forms.mappings.Mappings +import play.api.data.Form + +class ProductNameFormProvider @Inject() extends Mappings { + + def apply(): Form[String] = + Form( + "value" -> text("productName.error.required") + .verifying(maxLength(50, "productName.error.length")) + ) +} diff --git a/app/pages/ProductNamePage.scala b/app/pages/ProductNamePage.scala new file mode 100644 index 00000000..38d8ce66 --- /dev/null +++ b/app/pages/ProductNamePage.scala @@ -0,0 +1,26 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package pages + +import play.api.libs.json.JsPath + +case object ProductNamePage extends QuestionPage[String] { + + override def path: JsPath = JsPath \ toString + + override def toString: String = "productName" +} diff --git a/app/viewmodels/checkAnswers/ProductNameSummary.scala b/app/viewmodels/checkAnswers/ProductNameSummary.scala new file mode 100644 index 00000000..d2c49372 --- /dev/null +++ b/app/viewmodels/checkAnswers/ProductNameSummary.scala @@ -0,0 +1,43 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package viewmodels.checkAnswers + +import controllers.routes +import models.{CheckMode, UserAnswers} +import pages.ProductNamePage +import play.api.i18n.Messages +import play.twirl.api.HtmlFormat +import uk.gov.hmrc.govukfrontend.views.viewmodels.summarylist.SummaryListRow +import viewmodels.govuk.summarylist._ +import viewmodels.implicits._ + +object ProductNameSummary { + + def row(answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] = + answers.get(ProductNamePage).map { + answer => + + SummaryListRowViewModel( + key = "productName.checkYourAnswersLabel", + value = ValueViewModel(HtmlFormat.escape(answer).toString), + actions = Seq( + ActionItemViewModel("site.change", routes.ProductNameController.onPageLoad(CheckMode).url) + .withVisuallyHiddenText(messages("productName.change.hidden")) + ) + ) + } +} diff --git a/app/views/ProductNameView.scala.html b/app/views/ProductNameView.scala.html new file mode 100644 index 00000000..5aa394fc --- /dev/null +++ b/app/views/ProductNameView.scala.html @@ -0,0 +1,49 @@ +@* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@import viewmodels.InputWidth._ + +@this( + layout: templates.Layout, + formHelper: FormWithCSRF, + govukErrorSummary: GovukErrorSummary, + govukInput: GovukInput, + govukButton: GovukButton +) + +@(form: Form[_], mode: Mode)(implicit request: Request[_], messages: Messages) + +@layout(pageTitle = title(form, messages("productName.title"))) { + + @formHelper(action = routes.ProductNameController.onSubmit(mode)) { + + @if(form.errors.nonEmpty) { + @govukErrorSummary(ErrorSummaryViewModel(form)) + } + + @govukInput( + InputViewModel( + field = form("value"), + label = LabelViewModel(messages("productName.heading")).asPageHeading() + ) + .withWidth(Full) + ) + + @govukButton( + ButtonViewModel(messages("site.continue")) + ) + } +} diff --git a/conf/app.routes b/conf/app.routes index c4b69234..6093af61 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -24,3 +24,8 @@ GET /draughtReliefQuestion controllers.DraughtReli POST /draughtReliefQuestion controllers.DraughtReliefQuestionController.onSubmit(mode: Mode = NormalMode) GET /changeDraughtReliefQuestion controllers.DraughtReliefQuestionController.onPageLoad(mode: Mode = CheckMode) POST /changeDraughtReliefQuestion controllers.DraughtReliefQuestionController.onSubmit(mode: Mode = CheckMode) + +GET /productName controllers.ProductNameController.onPageLoad(mode: Mode = NormalMode) +POST /productName controllers.ProductNameController.onSubmit(mode: Mode = NormalMode) +GET /changeProductName controllers.ProductNameController.onPageLoad(mode: Mode = CheckMode) +POST /changeProductName controllers.ProductNameController.onSubmit(mode: Mode = CheckMode) diff --git a/conf/messages.en b/conf/messages.en index 4fa2da90..b5db2440 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -64,4 +64,11 @@ draughtReliefQuestion.title = Is this product eligible for Draught Relief? draughtReliefQuestion.heading = Is this product eligible for Draught Relief? draughtReliefQuestion.error.required = Select yes if this product is eligible for Draught Relief draughtReliefQuestion.guidance.link.url = https://www.gov.uk/guidance/check-if-you-can-pay-less-alcohol-duty-on-draught-products -draughtReliefQuestion.guidance.link.text = You can get a reduced rate of duty on some draught products (opens in a new tab) \ No newline at end of file +draughtReliefQuestion.guidance.link.text = You can get a reduced rate of duty on some draught products (opens in a new tab) + +productName.title = What name do you want to give this product? +productName.heading = What name do you want to give this product? +productName.checkYourAnswersLabel = Name +productName.error.required = Enter the name you want to give this product +productName.error.length = Product name must be 50 characters or less +productName.change.hidden = name diff --git a/test/controllers/ProductNameControllerSpec.scala b/test/controllers/ProductNameControllerSpec.scala new file mode 100644 index 00000000..8d5f64fe --- /dev/null +++ b/test/controllers/ProductNameControllerSpec.scala @@ -0,0 +1,160 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package controllers + +import base.SpecBase +import connectors.CacheConnector +import forms.ProductNameFormProvider +import models.{NormalMode, UserAnswers} +import navigation.{FakeNavigator, Navigator} +import org.mockito.ArgumentMatchers.any +import org.mockito.Mockito.when +import org.scalatestplus.mockito.MockitoSugar +import pages.ProductNamePage +import play.api.inject.bind +import play.api.mvc.Call +import play.api.test.FakeRequest +import play.api.test.Helpers._ +import repositories.SessionRepository +import uk.gov.hmrc.http.HttpResponse +import views.html.ProductNameView + +import scala.concurrent.Future + +class ProductNameControllerSpec extends SpecBase with MockitoSugar { + + def onwardRoute = Call("GET", "/foo") + + val formProvider = new ProductNameFormProvider() + val form = formProvider() + + lazy val productNameRoute = routes.ProductNameController.onPageLoad(NormalMode).url + + "ProductName Controller" - { + + "must return OK and the correct view for a GET" in { + + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() + + running(application) { + val request = FakeRequest(GET, productNameRoute) + + val result = route(application, request).value + + val view = application.injector.instanceOf[ProductNameView] + + status(result) mustEqual OK + contentAsString(result) mustEqual view(form, NormalMode)(request, messages(application)).toString + } + } + + "must populate the view correctly on a GET when the question has previously been answered" in { + + val userAnswers = UserAnswers(userAnswersId).set(ProductNamePage, "answer").success.value + + val application = applicationBuilder(userAnswers = Some(userAnswers)).build() + + running(application) { + val request = FakeRequest(GET, productNameRoute) + + val view = application.injector.instanceOf[ProductNameView] + + val result = route(application, request).value + + status(result) mustEqual OK + contentAsString(result) mustEqual view(form.fill("answer"), NormalMode)(request, messages(application)).toString + } + } + + "must redirect to the next page when valid data is submitted" in { + + val mockCacheConnector = mock[CacheConnector] + + when(mockCacheConnector.set(any())(any())) thenReturn Future.successful(mock[HttpResponse]) + + val application = + applicationBuilder(userAnswers = Some(emptyUserAnswers)) + .overrides( + bind[Navigator].toInstance(new FakeNavigator(onwardRoute)), + bind[CacheConnector].toInstance(mockCacheConnector) + ) + .build() + + running(application) { + val request = + FakeRequest(POST, productNameRoute) + .withFormUrlEncodedBody(("value", "answer")) + + val result = route(application, request).value + + status(result) mustEqual SEE_OTHER + redirectLocation(result).value mustEqual onwardRoute.url + } + } + + "must return a Bad Request and errors when invalid data is submitted" in { + + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() + + running(application) { + val request = + FakeRequest(POST, productNameRoute) + .withFormUrlEncodedBody(("value", "")) + + val boundForm = form.bind(Map("value" -> "")) + + val view = application.injector.instanceOf[ProductNameView] + + val result = route(application, request).value + + status(result) mustEqual BAD_REQUEST + contentAsString(result) mustEqual view(boundForm, NormalMode)(request, messages(application)).toString + } + } + + //uncomment tests when we bring back requiredData: +// "must redirect to Journey Recovery for a GET if no existing data is found" in { +// +// val application = applicationBuilder(userAnswers = None).build() +// +// running(application) { +// val request = FakeRequest(GET, productNameRoute) +// +// val result = route(application, request).value +// +// status(result) mustEqual SEE_OTHER +// redirectLocation(result).value mustEqual routes.JourneyRecoveryController.onPageLoad().url +// } +// } +// +// "must redirect to Journey Recovery for a POST if no existing data is found" in { +// +// val application = applicationBuilder(userAnswers = None).build() +// +// running(application) { +// val request = +// FakeRequest(POST, productNameRoute) +// .withFormUrlEncodedBody(("value", "answer")) +// +// val result = route(application, request).value +// +// status(result) mustEqual SEE_OTHER +// redirectLocation(result).value mustEqual routes.JourneyRecoveryController.onPageLoad().url +// } +// } + } +} diff --git a/test/forms/ProductNameFormProviderSpec.scala b/test/forms/ProductNameFormProviderSpec.scala new file mode 100644 index 00000000..c7bd6cd7 --- /dev/null +++ b/test/forms/ProductNameFormProviderSpec.scala @@ -0,0 +1,53 @@ +/* + * Copyright 2023 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package forms + +import forms.behaviours.StringFieldBehaviours +import play.api.data.FormError + +class ProductNameFormProviderSpec extends StringFieldBehaviours { + + val requiredKey = "productName.error.required" + val lengthKey = "productName.error.length" + val maxLength = 50 + + val form = new ProductNameFormProvider()() + + ".value" - { + + val fieldName = "value" + + behave like fieldThatBindsValidData( + form, + fieldName, + stringsWithMaxLength(maxLength) + ) + + behave like fieldWithMaxLength( + form, + fieldName, + maxLength = maxLength, + lengthError = FormError(fieldName, lengthKey, Seq(maxLength)) + ) + + behave like mandatoryField( + form, + fieldName, + requiredError = FormError(fieldName, requiredKey) + ) + } +} From 2649d32186426d6ed5be159cc7dc773f42dc1850 Mon Sep 17 00:00:00 2001 From: yasaracar <9132533+yasaracar@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:05:22 +0000 Subject: [PATCH 2/9] ADR-743 Fix input box width --- .../checkAnswers/ProductNameSummary.scala | 20 +++++++++---------- app/views/ProductNameView.scala.html | 2 +- .../ProductNameControllerSpec.scala | 2 +- test/forms/ProductNameFormProviderSpec.scala | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/viewmodels/checkAnswers/ProductNameSummary.scala b/app/viewmodels/checkAnswers/ProductNameSummary.scala index d2c49372..ef61f87e 100644 --- a/app/viewmodels/checkAnswers/ProductNameSummary.scala +++ b/app/viewmodels/checkAnswers/ProductNameSummary.scala @@ -25,19 +25,17 @@ import uk.gov.hmrc.govukfrontend.views.viewmodels.summarylist.SummaryListRow import viewmodels.govuk.summarylist._ import viewmodels.implicits._ -object ProductNameSummary { +object ProductNameSummary { def row(answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] = - answers.get(ProductNamePage).map { - answer => - - SummaryListRowViewModel( - key = "productName.checkYourAnswersLabel", - value = ValueViewModel(HtmlFormat.escape(answer).toString), - actions = Seq( - ActionItemViewModel("site.change", routes.ProductNameController.onPageLoad(CheckMode).url) - .withVisuallyHiddenText(messages("productName.change.hidden")) - ) + answers.get(ProductNamePage).map { answer => + SummaryListRowViewModel( + key = "productName.checkYourAnswersLabel", + value = ValueViewModel(HtmlFormat.escape(answer).toString), + actions = Seq( + ActionItemViewModel("site.change", routes.ProductNameController.onPageLoad(CheckMode).url) + .withVisuallyHiddenText(messages("productName.change.hidden")) ) + ) } } diff --git a/app/views/ProductNameView.scala.html b/app/views/ProductNameView.scala.html index 5aa394fc..39eca862 100644 --- a/app/views/ProductNameView.scala.html +++ b/app/views/ProductNameView.scala.html @@ -39,7 +39,7 @@ field = form("value"), label = LabelViewModel(messages("productName.heading")).asPageHeading() ) - .withWidth(Full) + .withWidth(Fixed10) ) @govukButton( diff --git a/test/controllers/ProductNameControllerSpec.scala b/test/controllers/ProductNameControllerSpec.scala index 8d5f64fe..be4783c2 100644 --- a/test/controllers/ProductNameControllerSpec.scala +++ b/test/controllers/ProductNameControllerSpec.scala @@ -40,7 +40,7 @@ class ProductNameControllerSpec extends SpecBase with MockitoSugar { def onwardRoute = Call("GET", "/foo") val formProvider = new ProductNameFormProvider() - val form = formProvider() + val form = formProvider() lazy val productNameRoute = routes.ProductNameController.onPageLoad(NormalMode).url diff --git a/test/forms/ProductNameFormProviderSpec.scala b/test/forms/ProductNameFormProviderSpec.scala index c7bd6cd7..e6321fd3 100644 --- a/test/forms/ProductNameFormProviderSpec.scala +++ b/test/forms/ProductNameFormProviderSpec.scala @@ -22,8 +22,8 @@ import play.api.data.FormError class ProductNameFormProviderSpec extends StringFieldBehaviours { val requiredKey = "productName.error.required" - val lengthKey = "productName.error.length" - val maxLength = 50 + val lengthKey = "productName.error.length" + val maxLength = 50 val form = new ProductNameFormProvider()() From ae0d29dae3644f4060e233879085f8e39c9170e0 Mon Sep 17 00:00:00 2001 From: yasaracar <9132533+yasaracar@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:42:38 +0000 Subject: [PATCH 3/9] ADR-743 Add section heading and paragraphs --- app/views/ProductNameView.scala.html | 18 ++++++++++++++++-- conf/messages.en | 2 ++ .../ProductNameControllerSpec.scala | 1 - 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/views/ProductNameView.scala.html b/app/views/ProductNameView.scala.html index 39eca862..67b41e4b 100644 --- a/app/views/ProductNameView.scala.html +++ b/app/views/ProductNameView.scala.html @@ -15,19 +15,33 @@ *@ @import viewmodels.InputWidth._ +@import components.{SectionHeading, PageHeading} @this( layout: templates.Layout, formHelper: FormWithCSRF, govukErrorSummary: GovukErrorSummary, govukInput: GovukInput, - govukButton: GovukButton + govukButton: GovukButton, + sectionHeading: SectionHeading, + pageHeading: PageHeading ) @(form: Form[_], mode: Mode)(implicit request: Request[_], messages: Messages) @layout(pageTitle = title(form, messages("productName.title"))) { + @sectionHeading( + id = "product-name-section", + text = messages("section.alcoholDutyReturn"), + ) + + @pageHeading(messages("productName.heading")) + +
@messages("productName.p1")
+ +@messages("productName.p2")
+ @formHelper(action = routes.ProductNameController.onSubmit(mode)) { @if(form.errors.nonEmpty) { @@ -37,7 +51,7 @@ @govukInput( InputViewModel( field = form("value"), - label = LabelViewModel(messages("productName.heading")).asPageHeading() + label = LabelViewModel(Empty) ) .withWidth(Fixed10) ) diff --git a/conf/messages.en b/conf/messages.en index b5db2440..6237c428 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -68,6 +68,8 @@ draughtReliefQuestion.guidance.link.text = You can get a reduced rate of duty on productName.title = What name do you want to give this product? productName.heading = What name do you want to give this product? +productName.p1 = Give your product a name so you can identify it on your return. +productName.p2 = You may want to use an internal reference number or a description of the product's alcohol type and ABV strength. For example, 'Beer, 5.3%' productName.checkYourAnswersLabel = Name productName.error.required = Enter the name you want to give this product productName.error.length = Product name must be 50 characters or less diff --git a/test/controllers/ProductNameControllerSpec.scala b/test/controllers/ProductNameControllerSpec.scala index be4783c2..b7f9e151 100644 --- a/test/controllers/ProductNameControllerSpec.scala +++ b/test/controllers/ProductNameControllerSpec.scala @@ -29,7 +29,6 @@ import play.api.inject.bind import play.api.mvc.Call import play.api.test.FakeRequest import play.api.test.Helpers._ -import repositories.SessionRepository import uk.gov.hmrc.http.HttpResponse import views.html.ProductNameView From d72ccc588749f3ac9910c7b22012bf1ad598bd61 Mon Sep 17 00:00:00 2001 From: yasaracar <9132533+yasaracar@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:49:05 +0000 Subject: [PATCH 4/9] ADR-743 Styling changes --- app/views/ProductNameView.scala.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/ProductNameView.scala.html b/app/views/ProductNameView.scala.html index 67b41e4b..154ed3b1 100644 --- a/app/views/ProductNameView.scala.html +++ b/app/views/ProductNameView.scala.html @@ -53,11 +53,11 @@ field = form("value"), label = LabelViewModel(Empty) ) - .withWidth(Fixed10) + .withWidth(Fixed30) ) @govukButton( - ButtonViewModel(messages("site.continue")) + ButtonViewModel(messages("site.saveAndContinue")) ) } } From 155e9fe04cfe50a05b3f5b992165b330b29ba631 Mon Sep 17 00:00:00 2001 From: yasaracar <9132533+yasaracar@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:58:28 +0000 Subject: [PATCH 5/9] ADR-743 Fix error message location --- app/views/ProductNameView.scala.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/ProductNameView.scala.html b/app/views/ProductNameView.scala.html index 154ed3b1..3fcb324d 100644 --- a/app/views/ProductNameView.scala.html +++ b/app/views/ProductNameView.scala.html @@ -31,6 +31,10 @@ @layout(pageTitle = title(form, messages("productName.title"))) { + @if(form.errors.nonEmpty) { + @govukErrorSummary(ErrorSummaryViewModel(form)) + } + @sectionHeading( id = "product-name-section", text = messages("section.alcoholDutyReturn"), @@ -44,10 +48,6 @@ @formHelper(action = routes.ProductNameController.onSubmit(mode)) { - @if(form.errors.nonEmpty) { - @govukErrorSummary(ErrorSummaryViewModel(form)) - } - @govukInput( InputViewModel( field = form("value"), From 82b85344435e567678f48e4dd6a75311c6fed777 Mon Sep 17 00:00:00 2001 From: mycp98@govukButton( - ButtonViewModel(messages("site.continue")) + ButtonViewModel("saveAndContinueId", messages("site.continue")) .asLink(continueUrl) )
diff --git a/app/views/JourneyRecoveryStartAgainView.scala.html b/app/views/JourneyRecoveryStartAgainView.scala.html index 2462af3a..69b08f55 100644 --- a/app/views/JourneyRecoveryStartAgainView.scala.html +++ b/app/views/JourneyRecoveryStartAgainView.scala.html @@ -29,7 +29,7 @@@govukButton( - ButtonViewModel(messages("site.signIn")) + ButtonViewModel("saveAndContinueId", messages("site.signIn")) .asLink(routes.IndexController.onPageLoad.url) )
From db15cb2abe23a19eb0d4d11239e7dc792b771275 Mon Sep 17 00:00:00 2001 From: mycp98@govukButton( - ButtonViewModel("saveAndContinueId", messages("site.continue")) + ButtonViewModel("continueButton", messages("site.continue")) .asLink(continueUrl) )
diff --git a/app/views/JourneyRecoveryStartAgainView.scala.html b/app/views/JourneyRecoveryStartAgainView.scala.html index 69b08f55..a317c2b9 100644 --- a/app/views/JourneyRecoveryStartAgainView.scala.html +++ b/app/views/JourneyRecoveryStartAgainView.scala.html @@ -29,7 +29,7 @@@govukButton( - ButtonViewModel("saveAndContinueId", messages("site.signIn")) + ButtonViewModel("signInButton", messages("site.signIn")) .asLink(routes.IndexController.onPageLoad.url) )