| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 91c05ce commit 0f14485
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,7 +48,7 @@ trait ConsentsJourney | |||
| 48 | 48 | returnUrlForm.bindFromRequest.fold( | |
| 49 | 49 | formWithErrors => Future.successful(BadRequest(Json.toJson(formWithErrors.errors.toList))), | |
| 50 | 50 | returnUrl => { | |
| 51 | - val newConsents = if (request.user.consents.isEmpty) Consent.defaultConsents else request.user.consents | ||
| 51 | + val newConsents = if (request.user.consents.isEmpty) Consent.defaultConsents else Consent.addNewDefaults(request.user.consents) | ||
| 52 | 52 | identityApiClient.saveUser( | |
| 53 | 53 | request.user.id, | |
| 54 | 54 | UserUpdateDTO(consents = Some(newConsents), statusFields = Some(StatusFields(hasRepermissioned = Some(true)))), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ class PrivacyMapping extends UserFormMapping[PrivacyFormData] { | |||
| 34 | 34 | protected def toUserFormData(userDO: User): PrivacyFormData = | |
| 35 | 35 | PrivacyFormData(userDO) | |
| 36 | 36 | ||
| 37 | - protected lazy val idapiErrorContextToFormFieldKeyMap = Map( | ||
| 37 | + protected lazy val idapiErrorContextToFormFieldKeyMap = Map( | ||
| 38 | 38 | "statusFields.receiveGnmMarketing" -> "receiveGnmMarketing", | |
| 39 | 39 | "statusFields.receive3rdPartyMarketing" -> "receive3rdPartyMarketing", | |
| 40 | 40 | "statusFields.allowThirdPartyProfiling" -> "allowThirdPartyProfiling" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,8 +13,8 @@ object ConsentOrder { | |||
| 13 | 13 | "holidays", | |
| 14 | 14 | "events", | |
| 15 | 15 | "offers", | |
| 16 | - "post", | ||
| 17 | - "phone", | ||
| 16 | + "post_optout", | ||
| 17 | + "phone_optout", | ||
| 18 | 18 | "sms" | |
| 19 | 19 | ) | |
| 20 | 20 | ||
@@ -27,7 +27,11 @@ object ConsentOrder { | |||
| 27 | 27 | */ | |
| 28 | 28 | def userWithOrderedConsents(userDO: User, consentHint: Option[String]): User = { | |
| 29 | 29 | val consentsToReorder = | |
| 30 | - if (userDO.consents.isEmpty) Consent.defaultConsents else userDO.consents | ||
| 30 | + if (userDO.consents.isEmpty) | ||
| 31 | + Consent.defaultConsents | ||
| 32 | + else | ||
| 33 | + // handle any default consents that may have been added since this user was created. | ||
| 34 | + Consent.addNewDefaults(userDO.consents) | ||
| 31 | 35 | ||
| 32 | 36 | userDO.copy(consents = hintedConsents(orderedConsents(consentsToReorder), consentHint)) | |
| 33 | 37 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,28 +48,28 @@ <h3 class="manage-account__switch-title"> </h3> | |||
| 48 | 48 | } | |
| 49 | 49 | } | |
| 50 | 50 | ||
| 51 | - @channelStepContent = { | ||
| 52 | - <form action="@idUrlBuilder.buildUrl("/privacy/edit", idRequest)" class="js-manage-account__check-allCheckbox__ignore" role="main" method="post"> | ||
| 53 | - @views.html.helper.CSRF.formField | ||
| 54 | - <div class="manage-account__switches manage-account__switches--single-column"> | ||
| 55 | - <ul> | ||
| 56 | - @helper.repeatWithIndex(forms.privacyForm("consents"), min=1) { (consentField, index) => | ||
| 57 | - @if(isSmsChannel(consentField, user)) { | ||
| 58 | - <li> | ||
| 59 | - @fragments.consentSwitch(consentField = consentField, skin = skin)(messages) | ||
| 60 | - </li> | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - </ul> | ||
| 64 | - </div> | ||
| 65 | - </form> | ||
| 51 | + @smsStepContent = { | ||
| 52 | + @views.html.profile.smsConsent(idUrlBuilder, idRequest, forms.privacyForm, user)(request, messages) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @smsStep = @{ | ||
| 56 | + ConsentStep( | ||
| 57 | + name = "sms", | ||
| 58 | + title = "SMS updates", | ||
| 59 | + content = smsStepContent, | ||
| 60 | + show = true | ||
| 61 | + ) | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @nonElectronicOptOutContent = { | ||
| 65 | + @views.html.profile.nonElectronicOptOut(idUrlBuilder, idRequest, forms.privacyForm, user)(request, messages) | ||
| 66 | 66 | } | |
| 67 | 67 | ||
| 68 | - @channelStep = @{ | ||
| 68 | + @nonElectronicOptOutStep = @{ | ||
| 69 | 69 | ConsentStep( | |
| 70 | - name = "channels", | ||
| 70 | + name = "nonElectronicOptOut", | ||
| 71 | 71 | title = "How else can we get in touch with you?", | |
| 72 | - content = channelStepContent, | ||
| 72 | + content = nonElectronicOptOutContent, | ||
| 73 | 73 | show = true | |
| 74 | 74 | ) | |
| 75 | 75 | } | |
@@ -186,7 +186,8 @@ <h3 class="manage-account__switch-title"> </h3> | |||
| 186 | 186 | @defaultJourney = @{List( | |
| 187 | 187 | emailRepermissionStep, | |
| 188 | 188 | marketingConsentStep, | |
| 189 | - channelStep | ||
| 189 | + smsStep, | ||
| 190 | + nonElectronicOptOutStep | ||
| 190 | 191 | )} | |
| 191 | 192 | ||
| 192 | 193 | @confirmModal = { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | @* Product consent switch/checkbox *@ | |
| 6 | 6 | ||
| 7 | - @(consentField: Field, highlighted: Boolean = false, skin: Option[String] = None)(messages: play.api.i18n.Messages) | ||
| 7 | + @(consentField: Field, highlighted: Boolean = false, skin: Option[String] = None, boldTitle: Boolean = true)(messages: play.api.i18n.Messages) | ||
| 8 | 8 | ||
| 9 | 9 | @getConsentText(consentField: Field) = @{ | |
| 10 | 10 | Consent.wording( | |
@@ -26,5 +26,6 @@ | |||
| 26 | 26 | field = consentField("consented"), | |
| 27 | 27 | extraFields = consentHiddenFormFields, | |
| 28 | 28 | highlighted = highlighted, | |
| 29 | - skin = skin | ||
| 29 | + skin = skin, | ||
| 30 | + boldTitle = boldTitle | ||
| 30 | 31 | )(nonInputFields, messages) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,8 @@ | |||
| 10 | 10 | extraFields: List[Html] = Nil, | |
| 11 | 11 | footer: Option[Html] = None, | |
| 12 | 12 | highlighted: Boolean = false, | |
| 13 | - skin: Option[String] = None | ||
| 13 | + skin: Option[String] = None, | ||
| 14 | + boldTitle: Boolean = true | ||
| 14 | 15 | )(implicit handler: views.html.helper.FieldConstructor, messages: play.api.i18n.Messages) | |
| 15 | 16 | ||
| 16 | 17 | ||
@@ -27,15 +28,24 @@ | |||
| 27 | 28 | <div class="manage-account__switch-content"> | |
| 28 | 29 | @fragments.form.checkbox(field, Checkbox(field).args:_*) | |
| 29 | 30 | <div class="manage-account__switch-checkbox"></div> | |
| 30 | - <h3 class="manage-account__switch-title"> | ||
| 31 | - @title | ||
| 32 | - @if(subheading){ | ||
| 33 | - <em>@subheading</em> | ||
| 34 | - } | ||
| 35 | - </h3> | ||
| 31 | + @if(boldTitle) { | ||
| 32 | + <h3 class="manage-account__switch-title"> | ||
| 33 | + @title | ||
| 34 | + @if(subheading) { | ||
| 35 | + <em>@subheading</em> | ||
| 36 | + } | ||
| 37 | + </h3> | ||
| 38 | + } else { | ||
| 39 | + <p class="manage-account__switch-copy"> | ||
| 40 | + @title | ||
| 41 | + @if(subheading) { | ||
| 42 | + <em>@subheading</em> | ||
| 43 | + } | ||
| 44 | + </p> | ||
| 45 | + } | ||
| 36 | 46 | @if(description) { | |
| 37 | 47 | <p class="manage-account__switch-copy"> | |
| 38 | - @description | ||
| 48 | + @description.map(Html(_)) | ||
| 39 | 49 | </p> | |
| 40 | 50 | } | |
| 41 | 51 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,28 @@ | |||
| 1 | + @import _root_.form.IdFormHelpers.nonInputFields | ||
| 2 | + @import views.support.fragment.ConsentChannel._ | ||
| 3 | + @import views.support.fragment.Switch._ | ||
| 4 | + | ||
| 5 | + @( | ||
| 6 | + idUrlBuilder: services.IdentityUrlBuilder, | ||
| 7 | + idRequest: services.IdentityRequest, | ||
| 8 | + privacyForm: Form[_root_.form.PrivacyFormData], | ||
| 9 | + user: com.gu.identity.model.User, | ||
| 10 | + )(implicit request: RequestHeader, messages: play.api.i18n.Messages) | ||
| 11 | + <form method="post" action="@idUrlBuilder.buildUrl("/privacy/edit", idRequest)" novalidate> | ||
| 12 | + @views.html.helper.CSRF.formField | ||
| 13 | + <div class="manage-account__switches manage-account__switches--single-column js-manage-account__check-allCheckbox__ignore"> | ||
| 14 | + | ||
| 15 | + <p class="identity-title-explainer">From time to time we’d love to be able to update you about the products and services that you’ve selected above by post or telephone.</p> | ||
| 16 | + <p class="identity-title-explainer">Please tick the boxes below to let us know if you <b>do not wish to receive</b> these.</p> | ||
| 17 | + | ||
| 18 | + <ul> | ||
| 19 | + @helper.repeatWithIndex(privacyForm("consents"), min=1){ (consentField, index) => | ||
| 20 | + @if(isOptOutChannel(consentField, user)) { | ||
| 21 | + <li> | ||
| 22 | + @fragments.consentSwitch(consentField, boldTitle = false)(messages) | ||
| 23 | + </li> | ||
| 24 | + } | ||
| 25 | + } | ||
| 26 | + </ul> | ||
| 27 | + </div> | ||
| 28 | + </form> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + @import _root_.form.IdFormHelpers.nonInputFields | ||
| 2 | + @import views.support.fragment.ConsentChannel._ | ||
| 3 | + @import views.support.fragment.Switch._ | ||
| 4 | + | ||
| 5 | + @( | ||
| 6 | + idUrlBuilder: services.IdentityUrlBuilder, | ||
| 7 | + idRequest: services.IdentityRequest, | ||
| 8 | + privacyForm: Form[_root_.form.PrivacyFormData], | ||
| 9 | + user: com.gu.identity.model.User | ||
| 10 | + )(implicit request: RequestHeader, messages: play.api.i18n.Messages) | ||
| 11 | + <fieldset class="fieldset fieldset--manage-account-noborder"> | ||
| 12 | + <div class="fieldset__heading"> | ||
| 13 | + <h2 class="form__heading">SMS updates</h2> | ||
| 14 | + </div> | ||
| 15 | + <div class="fieldset__fields"> | ||
| 16 | + @views.html.profile.smsConsent(idUrlBuilder, idRequest, privacyForm, user)(request, messages) | ||
| 17 | + </div> | ||
| 18 | + </fieldset> | ||
| 19 | + <fieldset class="fieldset"> | ||
| 20 | + <div class="fieldset__heading"> | ||
| 21 | + <h2 class="form__heading">How else can we get in touch with you?</h2> | ||
| 22 | + </div> | ||
| 23 | + <div class="fieldset__fields"> | ||
| 24 | + @views.html.profile.nonElectronicOptOut(idUrlBuilder, idRequest, privacyForm, user)(request, messages) | ||
| 25 | + </div> | ||
| 26 | + </fieldset> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,23 +76,6 @@ <h2 class="form__heading">What can we tell you about?</h2> | |||
| 76 | 76 | </form> | |
| 77 | 77 | } | |
| 78 | 78 | ||
| 79 | - @channelConsentForm = { | ||
| 80 | - <form method="post" action="@idUrlBuilder.buildUrl("/privacy/edit", idRequest)" novalidate> | ||
| 81 | - @views.html.helper.CSRF.formField | ||
| 82 | - <div class="manage-account__switches"> | ||
| 83 | - <ul> | ||
| 84 | - @helper.repeatWithIndex(privacyForm("consents"), min=1) { (consentField, index) => | ||
| 85 | - @if(isSmsChannel(consentField, user)) { | ||
| 86 | - <li> | ||
| 87 | - @fragments.consentSwitch(consentField)(messages) | ||
| 88 | - </li> | ||
| 89 | - } | ||
| 90 | - } | ||
| 91 | - </ul> | ||
| 92 | - </div> | ||
| 93 | - </form> | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | 79 | @if(consentsUpdated) { | |
| 97 | 80 | <div class="form__success"> | |
| 98 | 81 | <h2>Thank you</h2> | |
@@ -110,19 +93,6 @@ <h2>Thank you</h2> | |||
| 110 | 93 | @* CHANNELS *@ | |
| 111 | 94 | <hr class="manage-account-divider" /> | |
| 112 | 95 | ||
| 113 | - <fieldset class="fieldset fieldset--manage-account-noborder"> | ||
| 114 | - <div class="fieldset__heading"> | ||
| 115 | - <h2 class="form__heading">How else can we get in touch with you?</h2> | ||
| 116 | - </div> | ||
| 117 | - <div class="fieldset__fields"> | ||
| 118 | - @if(channelsProvidedBy(user).nonEmpty) { | ||
| 119 | - @channelConsentForm | ||
| 120 | - } else { | ||
| 121 | - <p class="identity-title-explainer"> | ||
| 122 | - Update your <a class="u-underline" href="@idUrlBuilder.buildUrl(controllers.editprofile.routes.EditProfileController.displayAccountForm.url, idRequest)" data-link-name="identity : email : add-channel-info">account details</a> with your phone number to be able to opt in to receiving SMS communications from the Guardian. | ||
| 123 | - </p> | ||
| 124 | - } | ||
| 125 | - </div> | ||
| 126 | - </fieldset> | ||
| 96 | + @views.html.profile.otherChannels(idUrlBuilder, idRequest, privacyForm, user)(request, messages) | ||
| 127 | 97 | ||
| 128 | 98 | @registrationFooter(idRequest, idUrlBuilder) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + @import _root_.form.IdFormHelpers.nonInputFields | ||
| 2 | + @import views.support.fragment.ConsentChannel._ | ||
| 3 | + @import views.support.fragment.Switch._ | ||
| 4 | + | ||
| 5 | + @( | ||
| 6 | + idUrlBuilder: services.IdentityUrlBuilder, | ||
| 7 | + idRequest: services.IdentityRequest, | ||
| 8 | + privacyForm: Form[_root_.form.PrivacyFormData], | ||
| 9 | + user: com.gu.identity.model.User, | ||
| 10 | + )(implicit request: RequestHeader, messages: play.api.i18n.Messages) | ||
| 11 | + <form method="post" action="@idUrlBuilder.buildUrl("/privacy/edit", idRequest)" novalidate> | ||
| 12 | + @views.html.helper.CSRF.formField | ||
| 13 | + <div class="manage-account__switches manage-account__switches--single-column"> | ||
| 14 | + <ul> | ||
| 15 | + @helper.repeatWithIndex(privacyForm("consents"), min=1) { (consentField, index) => | ||
| 16 | + @if(isSmsChannel(consentField, user)) { | ||
| 17 | + <li> | ||
| 18 | + @fragments.form.switch( | ||
| 19 | + title = "", | ||
| 20 | + subheading = None, | ||
| 21 | + description = Some("I would like to receive updates about the Guardian products and services I’ve selected above <b>by SMS</b> (text messages)."), | ||
| 22 | + behaviour = ConsentSwitch, | ||
| 23 | + field = consentField("consented"), | ||
| 24 | + extraFields = List("actor","id","version","timestamp","privacyPolicyVersion").map { field => fragments.form.hidden(consentField(field)) } | ||
| 25 | + )(nonInputFields, messages) | ||
| 26 | + </li> | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | + </ul> | ||
| 30 | + </div> | ||
| 31 | + </form> | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments