Unverified Commit 8752480a by Diana Huang Committed by GitHub

Merge pull request #16829 from edx/diana/registration-form-improvements

LEARNER-3469 - More registration form cleanup.
parents 171e6715 0ecc0558
...@@ -213,7 +213,8 @@ ...@@ -213,7 +213,8 @@
isCheckbox = $input.attr('class').indexOf('checkbox') !== -1; isCheckbox = $input.attr('class').indexOf('checkbox') !== -1;
if (!isCheckbox) { if (!isCheckbox) {
if ($input.val().length === 0 && !$input.is(':-webkit-autofill')) { if ($input.find(inputSelectors).val().length === 0
&& !$input.is(':-webkit-autofill')) {
$input.find('label').addClass('focus-out') $input.find('label').addClass('focus-out')
.removeClass('focus-in'); .removeClass('focus-in');
} else { } else {
...@@ -235,12 +236,14 @@ ...@@ -235,12 +236,14 @@
// is a required checkbox field and the optional fields toggle is a cosmetic // is a required checkbox field and the optional fields toggle is a cosmetic
// improvement so that we don't have to show all the optional fields. // improvement so that we don't have to show all the optional fields.
// xss-lint: disable=javascript-jquery-insert-into-target // xss-lint: disable=javascript-jquery-insert-into-target
$('.checkbox-optional_fields_toggle').insertBefore('.optional-fields'); $('.checkbox-optional_fields_toggle').insertAfter('.required-fields');
if (!this.hasOptionalFields) { if (!this.hasOptionalFields) {
$('.checkbox-optional_fields_toggle').addClass('hidden'); $('.checkbox-optional_fields_toggle').addClass('hidden');
} }
// xss-lint: disable=javascript-jquery-insert-into-target // xss-lint: disable=javascript-jquery-insert-into-target
$('.checkbox-honor_code').insertAfter('.optional-fields'); $('.checkbox-honor_code').insertAfter('.optional-fields');
// xss-lint: disable=javascript-jquery-insert-into-target
$('.checkbox-terms_of_service').insertAfter('.optional-fields');
// Clicking on links inside a label should open that link. // Clicking on links inside a label should open that link.
$('label a').click(function(ev) { $('label a').click(function(ev) {
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
<span class="text"><%- gettext("or create a new one here") %></span> <span class="text"><%- gettext("or create a new one here") %></span>
</h3> </h3>
</div> </div>
<% } else { %>
<h2><%- gettext('Create an Account')%></h2>
<% } %> <% } %>
<% } else if (context.autoRegisterWelcomeMessage) { %> <% } else if (context.autoRegisterWelcomeMessage) { %>
<span class="auto-register-message"><%- context.autoRegisterWelcomeMessage %></span> <span class="auto-register-message"><%- context.autoRegisterWelcomeMessage %></span>
......
...@@ -786,13 +786,14 @@ class RegistrationFormFactory(object): ...@@ -786,13 +786,14 @@ class RegistrationFormFactory(object):
# in order to register a new account. # in order to register a new account.
terms_label = _(u"Terms of Service") terms_label = _(u"Terms of Service")
terms_link = marketing_link("TOS") terms_link = marketing_link("TOS")
terms_text = _(u"Review the Terms of Service")
# Translators: "Terms of service" is a legal document users must agree to # Translators: "Terms of service" is a legal document users must agree to
# in order to register a new account. # in order to register a new account.
label = _(u"I agree to the {platform_name} {terms_of_service}").format( label = Text(_(u"I agree to the {platform_name} {tos_link_start}{terms_of_service}{tos_link_end}")).format(
platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME), platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_label terms_of_service=terms_label,
tos_link_start=HTML("<a href='{terms_link}' target='_blank'>").format(terms_link=terms_link),
tos_link_end=HTML("</a>"),
) )
# Translators: "Terms of service" is a legal document users must agree to # Translators: "Terms of service" is a legal document users must agree to
...@@ -811,8 +812,6 @@ class RegistrationFormFactory(object): ...@@ -811,8 +812,6 @@ class RegistrationFormFactory(object):
error_messages={ error_messages={
"required": error_msg "required": error_msg
}, },
supplementalLink=terms_link,
supplementalText=terms_text
) )
def _apply_third_party_auth_overrides(self, request, form_desc): def _apply_third_party_auth_overrides(self, request, form_desc):
......
...@@ -1593,12 +1593,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase): ...@@ -1593,12 +1593,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase):
# Terms of service field should also be present # Terms of service field should also be present
link_label = "Terms of Service" link_label = "Terms of Service"
link_template = "<a href='https://www.test.com/tos' target='_blank'>{link_label}</a>"
self._assert_reg_field( self._assert_reg_field(
{"honor_code": "required", "terms_of_service": "required"}, {"honor_code": "required", "terms_of_service": "required"},
{ {
"label": u"I agree to the {platform_name} {link_label}".format( "label": u"I agree to the {platform_name} {link_label}".format(
platform_name=settings.PLATFORM_NAME, platform_name=settings.PLATFORM_NAME,
link_label=link_label link_label=link_template.format(link_label=link_label)
), ),
"name": "terms_of_service", "name": "terms_of_service",
"defaultValue": False, "defaultValue": False,
...@@ -1640,12 +1641,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase): ...@@ -1640,12 +1641,13 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, UserAPITestCase):
link_label = 'Terms of Service' link_label = 'Terms of Service'
# Terms of service field should also be present # Terms of service field should also be present
link_template = "<a href='/tos' target='_blank'>{link_label}</a>"
self._assert_reg_field( self._assert_reg_field(
{"honor_code": "required", "terms_of_service": "required"}, {"honor_code": "required", "terms_of_service": "required"},
{ {
"label": u"I agree to the {platform_name} {link_label}".format( "label": u"I agree to the {platform_name} {link_label}".format(
platform_name=settings.PLATFORM_NAME, platform_name=settings.PLATFORM_NAME,
link_label=link_label link_label=link_template.format(link_label=link_label)
), ),
"name": "terms_of_service", "name": "terms_of_service",
"defaultValue": False, "defaultValue": False,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment