mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Bugfix for signup screen
caused by issue #326 - implementing fade in and center on signup form by applying the functionality to a shared view - login and signup now both extend the shared view
This commit is contained in:
parent
b4e0a7144b
commit
ec1ced9089
@ -2,15 +2,9 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
Ghost.Views.Login = Ghost.View.extend({
|
||||
|
||||
templateName: "login",
|
||||
|
||||
events: {
|
||||
'submit #login': 'submitHandler'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
Ghost.SimpleFormView = Ghost.View.extend({
|
||||
initialize: function () {
|
||||
this.render();
|
||||
$(window).trigger('resize');
|
||||
},
|
||||
@ -18,12 +12,34 @@
|
||||
afterRender: function () {
|
||||
var self = this;
|
||||
|
||||
$(window).on('resize', _.debounce(function (e) {
|
||||
$(".js-login-container").center();
|
||||
}, 100));
|
||||
$(window).on('resize', self.centerOnResize);
|
||||
|
||||
$(window).one('centered', self.fadeInAndFocus);
|
||||
return this;
|
||||
},
|
||||
|
||||
fadeInAndFocus: function () {
|
||||
$(".js-login-container").fadeIn(750, function () {
|
||||
$("[name='email']").focus();
|
||||
});
|
||||
},
|
||||
|
||||
centerOnResize: _.debounce(function (e) {
|
||||
$(".js-login-container").center();
|
||||
}, 100),
|
||||
|
||||
remove: function () {
|
||||
var self = this;
|
||||
$(window).off('resize', self.centerOnResize);
|
||||
$(window).off('centered', self.fadeInAndFocus);
|
||||
}
|
||||
});
|
||||
|
||||
Ghost.Views.Login = Ghost.SimpleFormView.extend({
|
||||
|
||||
templateName: "login",
|
||||
|
||||
events: {
|
||||
'submit #login': 'submitHandler'
|
||||
},
|
||||
|
||||
submitHandler: function (event) {
|
||||
@ -52,16 +68,10 @@
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
fadeInAndFocus: function () {
|
||||
$(".js-login-container").fadeIn(750, function () {
|
||||
$("[name='email']").focus();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Ghost.Views.Signup = Ghost.View.extend({
|
||||
Ghost.Views.Signup = Ghost.SimpleFormView.extend({
|
||||
|
||||
templateName: "signup",
|
||||
|
||||
@ -69,10 +79,6 @@
|
||||
'submit #register': 'submitHandler'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.render();
|
||||
},
|
||||
|
||||
submitHandler: function (event) {
|
||||
event.preventDefault();
|
||||
var email = this.$el.find('.email').val(),
|
||||
|
Loading…
Reference in New Issue
Block a user