Commit c7f54311 by AlasdairSwan

Merge pull request #5973 from edx/alasdair/logistration-password-scroll

ECOM-650 updated to add auto scrolling for password reset view
parents 5d156917 dff0acf5
...@@ -141,6 +141,7 @@ var edx = edx || {}; ...@@ -141,6 +141,7 @@ var edx = edx || {};
this.element.hide( this.$header ); this.element.hide( this.$header );
this.element.hide( $(this.el).find('.form-type') ); this.element.hide( $(this.el).find('.form-type') );
this.loadForm('reset'); this.loadForm('reset');
this.element.scrollTop( $('#password-reset-wrapper') );
}, },
showFormError: function() { showFormError: function() {
...@@ -162,11 +163,7 @@ var edx = edx || {}; ...@@ -162,11 +163,7 @@ var edx = edx || {};
this.element.hide( $(this.el).find('.form-wrapper') ); this.element.hide( $(this.el).find('.form-wrapper') );
this.element.show( $form ); this.element.show( $form );
this.element.scrollTop( $anchor );
// Scroll to top of selected form
$('html,body').animate({
scrollTop: $anchor.offset().top
},'slow');
}, },
/** /**
...@@ -261,7 +258,7 @@ var edx = edx || {}; ...@@ -261,7 +258,7 @@ var edx = edx || {};
} }
}, },
/* Helper method ot toggle display /* Helper method to toggle display
* including accessibility considerations * including accessibility considerations
*/ */
element: { element: {
...@@ -270,6 +267,13 @@ var edx = edx || {}; ...@@ -270,6 +267,13 @@ var edx = edx || {};
.attr('aria-hidden', true); .attr('aria-hidden', true);
}, },
scrollTop: function( $el ) {
// Scroll to top of selected element
$('html,body').animate({
scrollTop: $el.offset().top
},'slow');
},
show: function( $el ) { show: function( $el ) {
$el.removeClass('hidden') $el.removeClass('hidden')
.attr('aria-hidden', false); .attr('aria-hidden', false);
......
...@@ -103,6 +103,13 @@ var edx = edx || {}; ...@@ -103,6 +103,13 @@ var edx = edx || {};
} }
}, },
scrollTop: function( $el ) {
// Scroll to top of selected element
$('html,body').animate({
scrollTop: $el.offset().top
},'slow');
},
show: function( $el ) { show: function( $el ) {
if ( $el ) { if ( $el ) {
$el.removeClass('hidden') $el.removeClass('hidden')
......
...@@ -21,24 +21,26 @@ var edx = edx || {}; ...@@ -21,24 +21,26 @@ var edx = edx || {};
submitButton: '.js-reset', submitButton: '.js-reset',
preRender: function( data ) { preRender: function() {
this.listenTo( this.model, 'sync', this.saveSuccess ); this.listenTo( this.model, 'sync', this.saveSuccess );
}, },
toggleErrorMsg: function( show ) { toggleErrorMsg: function( show ) {
if ( show ) { if ( show ) {
this.setErrors(); this.setErrors();
this.toggleDisableButton(false) this.toggleDisableButton(false);
} else { } else {
this.element.hide( this.$errors ); this.element.hide( this.$errors );
} }
}, },
saveSuccess: function() { saveSuccess: function() {
var $el = $(this.el); var $el = $(this.el),
$msg = $el.find('.js-reset-success');
this.element.hide( $el.find('#password-reset-form') ); this.element.hide( $el.find('#password-reset-form') );
this.element.show( $el.find('.js-reset-success') ); this.element.show( $msg );
this.element.scrollTop( $msg );
} }
}); });
......
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