Back to Frontend

ConsentJourney.Scala

identity/app/views/consentJourney.scala.html

latest3.1 KB
Original Source

@import services.EmailPrefsData @import views.support.fragment.ConsentBlock._ @import views.support.fragment.ConsentChannel._ @import controllers.editprofile.ProfileForms @import _root_.utils.ConsentsJourneyType._ @import services.newsletters.model.NewsletterResponse @( user: com.gu.identity.model.User, forms: ProfileForms, journey: AnyConsentsJourney, verifiedReturnUrl: String, idRequest: services.IdentityRequest, idUrlBuilder: services.IdentityUrlBuilder, emailPrefsForm: Form[EmailPrefsData], emailSubscriptions: List[String], availableLists: List[NewsletterResponse], consentHint: Option[String] = None, skin: Option[String] = None)(implicit request: RequestHeader, messages: play.api.i18n.Messages, context: model.ApplicationContext) @selectAllCheckboxContent = {

} @marketingStepContent = { @views.html.helper.CSRF.formField

@helper.repeatWithIndex(forms.privacyForm("consents"), min = 1) { (consentField, index) => @{ /* Temporary fix - the 'holidays' marketing email is going to be replaced, so we don't want to include it on the list inviting new users to sign-up for it. But, the consentOption for holidays cannot be removed from the data source in Identity as we need to render the option to unsubscribe on the 'manage you account' page. The conditional for special casing 'holidays' can be removed after the Identity data source is re-released without 'holidays' in the data. */ } @if(!isChannel(consentField) && !isProduct(consentField) && !isHolidays(consentField)) { @if(index == 0) { - @fragments.consentSwitch(consentField, consentHint, skin = skin)(messages) } else { - @fragments.consentSwitch(consentField, skin = skin)(messages) } } }

} @marketingConsentStep = @{ ConsentStep( name = "marketing-consents", title = "Guardian products and services", content = marketingStepContent ) } @introThankYouStep= @{ ConsentStep( name = "intro", title = "Would you like to hear about any of these Guardian products?", help = List( ConsentStepHelpText( "Set your preferences: please let us know if you are interested in any of these products or services." ), ConsentStepHelpText( "You can change your preferences anytime by signing in, clicking My Account, then selecting Email Preferences." ) ), content = selectAllCheckboxContent, ) } @introStep = @{ ConsentStep( name = "intro", title = "Please select the emails you wish to receive", help = List( ConsentStepHelpText( "You can change your preferences anytime by signing in, clicking My Account, then selecting Email Preferences." ) ), content = selectAllCheckboxContent, extraClassNames = List("intro") ) } @defaultJourney = @{List( marketingConsentStep, )} @displayJourney = { @renderBlocks( journey match { case ThankYouConsentsJourney => { List( ConsentBanner( "Thank you" ), introThankYouStep ) ++ defaultJourney } case _ => { List( introStep ) ++ defaultJourney } } ) @views.html.helper.CSRF.formField All done! @fragments.inlineSvg("arrow-right", "icon")

}

@if(emailPrefsForm.hasGlobalErrors) { @consentJourneyFragments.error(idRequest, idUrlBuilder) } else { @consentJourneyFragments.jsFallback(verifiedReturnUrl, idRequest, idUrlBuilder) @displayJourney }