Commit dff0acf5 by AlasdairSwan

ECOM-650 updated to add auto scrolling for password reset view

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