-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIPP-1583: Add Produce API short description page (#406)
* HIPP-1583: Add Produce API short description page * HIPP-1583: Address comments
- Loading branch information
1 parent
af2f75d
commit af55e90
Showing
16 changed files
with
485 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/forms/myapis/produce/ProduceApiShortDescriptionFormProvider.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2024 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.myapis.produce | ||
|
||
import forms.mappings.Mappings | ||
import play.api.data.Form | ||
|
||
import javax.inject.Inject | ||
|
||
class ProduceApiShortDescriptionFormProvider @Inject() extends Mappings { | ||
|
||
def apply(): Form[String] = | ||
Form( | ||
"value" -> text("produceApiShortDescription.error.required") | ||
.transform[String](_.trim, identity) | ||
.verifying(maxLength(180, "produceApiShortDescription.error.length")) | ||
.verifying(minLength(8, "produceApiShortDescription.error.length")) | ||
) | ||
} |
27 changes: 27 additions & 0 deletions
27
app/pages/myapis/produce/ProduceApiShortDescriptionPage.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2024 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.myapis.produce | ||
|
||
import pages.QuestionPage | ||
import play.api.libs.json.JsPath | ||
|
||
case object ProduceApiShortDescriptionPage extends QuestionPage[String] { | ||
|
||
override def path: JsPath = JsPath \ toString | ||
|
||
override def toString: String = "produceApiShortDescription" | ||
} |
43 changes: 43 additions & 0 deletions
43
app/viewmodels/checkAnswers/myapis/produce/ProduceApiShortDescriptionSummary.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2024 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.myapis.produce | ||
|
||
import controllers.myapis.produce.routes | ||
import models.{CheckMode, UserAnswers} | ||
import pages.myapis.produce.ProduceApiShortDescriptionPage | ||
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 ProduceApiShortDescriptionSummary { | ||
|
||
def row(answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] = | ||
answers.get(ProduceApiShortDescriptionPage).map { | ||
answer => | ||
|
||
SummaryListRowViewModel( | ||
key = "produceApiShortDescription.checkYourAnswersLabel", | ||
value = ValueViewModel(HtmlFormat.escape(answer).toString), | ||
actions = Seq( | ||
ActionItemViewModel("site.change", routes.ProduceApiShortDescriptionController.onPageLoad(CheckMode).url) | ||
.withVisuallyHiddenText(messages("produceApiShortDescription.change.hidden")) | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.