Skip to content

Commit

Permalink
PODS-9722:Removed Nunjucks related code (#224)
Browse files Browse the repository at this point in the history
* PODS-9722:Removed duoTemplate and Nunjucks related code
  • Loading branch information
dynamicwave4 authored Oct 17, 2024
1 parent 6447813 commit 4f97d5d
Show file tree
Hide file tree
Showing 227 changed files with 1,342 additions and 6,382 deletions.
29 changes: 7 additions & 22 deletions app/controllers/AgentCannotRegisterController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,23 @@
package controllers

import config.FrontendAppConfig

import javax.inject.Inject
import play.api.i18n.I18nSupport
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.AgentCannotRegisterView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class AgentCannotRegisterController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
config: FrontendAppConfig,
agentCannotRegisterView: AgentCannotRegisterView,
twirlMigration: TwirlMigration
)(implicit ec: ExecutionContext)
val controllerComponents: MessagesControllerComponents,
config: FrontendAppConfig,
agentCannotRegisterView: AgentCannotRegisterView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
val json = Json.obj(
"govUkUrl" -> config.govUkUrl
)

def template = twirlMigration.duoTemplate(
renderer.render("agentCannotRegister.njk", json),
agentCannotRegisterView()
)

template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(agentCannotRegisterView())
}
}
11 changes: 3 additions & 8 deletions app/controllers/AssistantNoAccessController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,20 @@ package controllers

import play.api.i18n.I18nSupport
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.AssistantNoAccessView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class AssistantNoAccessController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
assistantNoAccessView: AssistantNoAccessView,
twirlMigration: TwirlMigration
assistantNoAccessView: AssistantNoAccessView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
def template = twirlMigration.duoTemplate(renderer.render("assistantNoAccess.njk"), assistantNoAccessView())
template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(assistantNoAccessView())
}
}
26 changes: 6 additions & 20 deletions app/controllers/CannotRegisterPractitionerController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,22 @@ package controllers

import config.FrontendAppConfig
import play.api.i18n.I18nSupport
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.CannotRegisterPractitionerView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class CannotRegisterPractitionerController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
config: FrontendAppConfig,
cannotRegisterPractitionerView: CannotRegisterPractitionerView,
twirlMigration: TwirlMigration
)(implicit ec: ExecutionContext)
val controllerComponents: MessagesControllerComponents,
config: FrontendAppConfig,
cannotRegisterPractitionerView: CannotRegisterPractitionerView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
val json = Json.obj(
"contactHmrcUrl" -> config.contactHmrcUrl
)

def template = twirlMigration.duoTemplate(
renderer.render("cannotRegisterPractitioner.njk",json),
cannotRegisterPractitionerView()
)

template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(cannotRegisterPractitionerView())
}
}
30 changes: 7 additions & 23 deletions app/controllers/NeedAnOrganisationAccountController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,23 @@
package controllers

import config.FrontendAppConfig

import javax.inject.Inject
import play.api.i18n.I18nSupport
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.NeedAnOrganisationAccountView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class NeedAnOrganisationAccountController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
config: FrontendAppConfig,
needAnOrganisationAccountView: NeedAnOrganisationAccountView,
twirlMigration: TwirlMigration
)(implicit ec: ExecutionContext)
val controllerComponents: MessagesControllerComponents,
config: FrontendAppConfig,
needAnOrganisationAccountView: NeedAnOrganisationAccountView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
val json = Json.obj(
"registerAsPensionAdministratorUrl" -> config.registerAsPensionAdministratorUrl,
"createGovGatewayUrl" -> config.createGovGatewayUrl,
"govUkUrl" -> config.govUkUrl
)

val template = twirlMigration.duoTemplate(
renderer.render("needAnOrganisationAccount.njk", json),
needAnOrganisationAccountView(config.govUkUrl, config.registerAsPensionAdministratorUrl, config.createGovGatewayUrl)
)
template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(needAnOrganisationAccountView(config.govUkUrl, config.registerAsPensionAdministratorUrl, config.createGovGatewayUrl))
}
}
22 changes: 7 additions & 15 deletions app/controllers/SessionExpiredController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,22 @@

package controllers

import javax.inject.Inject
import play.api.i18n.I18nSupport
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.SessionExpiredView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class SessionExpiredController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
sessionExpiredView: SessionExpiredView,
twirlMigration: TwirlMigration
)(implicit ec: ExecutionContext)
extends FrontendBaseController
val controllerComponents: MessagesControllerComponents,
sessionExpiredView: SessionExpiredView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
val template = twirlMigration.duoTemplate(
renderer.render("session-expired.njk"),
sessionExpiredView()
)
template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(sessionExpiredView())
}
}
35 changes: 10 additions & 25 deletions app/controllers/TellHMRCController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,26 @@ package controllers
import config.FrontendAppConfig
import controllers.actions._
import play.api.i18n.{I18nSupport, MessagesApi}
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import utils.annotations.AuthMustHaveNoEnrolmentWithNoIV
import views.html.TellHMRCView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class TellHMRCController @Inject()(
override val messagesApi: MessagesApi,
@AuthMustHaveNoEnrolmentWithNoIV authenticate: AuthAction,
getData: DataRetrievalAction,
requireData: DataRequiredAction,
config: FrontendAppConfig,
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
tellHMRCView: TellHMRCView,
twirlMigration: TwirlMigration
)(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport {
override val messagesApi: MessagesApi,
@AuthMustHaveNoEnrolmentWithNoIV authenticate: AuthAction,
getData: DataRetrievalAction,
requireData: DataRequiredAction,
config: FrontendAppConfig,
val controllerComponents: MessagesControllerComponents,
tellHMRCView: TellHMRCView
)(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport {

def onPageLoad(entityType: String): Action[AnyContent] = (authenticate andThen getData andThen requireData).async {
def onPageLoad(entityType: String): Action[AnyContent] = (authenticate andThen getData andThen requireData) {
implicit request =>
val json = Json.obj(
"entityType" -> entityType,
"companiesHouseUrl" -> config.companiesHouseFileChangesUrl,
"hmrcUrl" -> config.hmrcChangesMustReportUrl
)

val template = twirlMigration.duoTemplate(
renderer.render("tellHMRC.njk", json),
tellHMRCView(entityType, config.companiesHouseFileChangesUrl, config.hmrcChangesMustReportUrl)
)
template.map(Ok(_))
Ok(tellHMRCView(entityType, config.companiesHouseFileChangesUrl, config.hmrcChangesMustReportUrl))
}
}
16 changes: 4 additions & 12 deletions app/controllers/UnauthorisedController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,22 @@

package controllers

import javax.inject.Inject
import play.api.i18n.I18nSupport
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import views.html.UnauthorisedView

import javax.inject.Inject
import scala.concurrent.ExecutionContext

class UnauthorisedController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
unauthorisedView: UnauthorisedView,
twirlMigration: TwirlMigration
unauthorisedView: UnauthorisedView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action.async { implicit request =>
val template = twirlMigration.duoTemplate(
renderer.render("unauthorised.njk"),
unauthorisedView()
)
template.map(Ok(_))
def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(unauthorisedView())
}
}
19 changes: 3 additions & 16 deletions app/controllers/UpdateContactAddressController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@
package controllers

import controllers.actions.{AuthAction, DataRetrievalAction}
import models.{Address, CheckMode, UserAnswers}
import models.register.RegistrationLegalStatus.{Individual, LimitedCompany, Partnership}
import models.{Address, CheckMode, UserAnswers}
import pages.RegistrationDetailsPage
import pages.company.CompanyAddressPage
import pages.individual.IndividualManualAddressPage
import pages.partnership.PartnershipAddressPage
import play.api.i18n.I18nSupport
import play.api.libs.json.Json
import play.api.mvc.{Action, AnyContent, MessagesControllerComponents}
import renderer.Renderer
import services.PspDetailsService
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController
import utils.TwirlMigration
import utils.annotations.AuthMustHaveEnrolmentWithNoIV
import utils.countryOptions.CountryOptions
import views.html.UpdateContactAddressView
Expand All @@ -39,13 +36,11 @@ import scala.concurrent.{ExecutionContext, Future}

class UpdateContactAddressController @Inject()(
val controllerComponents: MessagesControllerComponents,
renderer: Renderer,
@AuthMustHaveEnrolmentWithNoIV authenticate: AuthAction,
getData: DataRetrievalAction,
countryOptions: CountryOptions,
pspDetailsService: PspDetailsService,
updateContactAddressView: UpdateContactAddressView,
twirlMigration: TwirlMigration
updateContactAddressView: UpdateContactAddressView
)(implicit ec: ExecutionContext)
extends FrontendBaseController
with I18nSupport {
Expand All @@ -55,15 +50,7 @@ class UpdateContactAddressController @Inject()(
pspDetailsService.getUserAnswers(request.userAnswers, request.user.pspIdOrException) flatMap {
retrieveRequiredValues(_) match {
case Some(Tuple2(url, address)) =>
val json = Json.obj(
"continueUrl" -> url,
"address" -> address.lines(countryOptions)
)
val template = twirlMigration.duoTemplate(
renderer.render("updateContactAddress.njk", json),
updateContactAddressView(address.lines(countryOptions), url)
)
template.map(Ok(_))
Future.successful(Ok(updateContactAddressView(address.lines(countryOptions), url)))
case None =>
Future.successful(Redirect(controllers.routes.SessionExpiredController.onPageLoad()))
}
Expand Down
Loading

0 comments on commit 4f97d5d

Please sign in to comment.