mirror of
https://github.com/flarum/core.git
synced 2025-08-06 16:36:47 +02:00
Finish signup process, including state restoration
This commit is contained in:
@@ -28,6 +28,7 @@ export default Ember.Controller.extend(ModalController, {
|
||||
return user.save().then(function(user) {
|
||||
controller.set('welcomeUser', user);
|
||||
controller.set('loading', false);
|
||||
controller.send('saveState');
|
||||
}, function(reason) {
|
||||
controller.set('loading', false);
|
||||
});
|
||||
|
@@ -7,6 +7,13 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
|
||||
activate: function() {
|
||||
if (!Ember.isEmpty(FLARUM_ALERT)) {
|
||||
this.controllerFor('alerts').send('alert', AlertMessage.create(FLARUM_ALERT));
|
||||
FLARUM_ALERT = null;
|
||||
}
|
||||
|
||||
var restoreUrl = localStorage.getItem('restoreUrl');
|
||||
if (restoreUrl && this.get('session.isAuthenticated')) {
|
||||
this.transitionTo(restoreUrl);
|
||||
localStorage.removeItem('restoreUrl');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -42,6 +49,10 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
|
||||
|
||||
sessionChanged: function() {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
saveState: function() {
|
||||
localStorage.setItem('restoreUrl', this.router.get('url'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -28,7 +28,7 @@
|
||||
{{ui/loading-indicator classNameBindings=":modal-loading loading:active"}}
|
||||
|
||||
{{#if welcomeUser}}
|
||||
<div {{bind-attr class=":signup-welcome :fade" style=welcomeStyle}}>
|
||||
<div {{bind-attr class=":signup-welcome" style=welcomeStyle}}>
|
||||
{{user-avatar welcomeUser}}
|
||||
<h3>Welcome, {{welcomeUser.username}}!</h3>
|
||||
|
||||
|
@@ -9,10 +9,10 @@ export default Ember.View.extend(ModalView, {
|
||||
didInsertElement: function() {
|
||||
},
|
||||
|
||||
welcomeUserDidChange: Ember.observer('welcomeUser', function() {
|
||||
if (this.get('welcomeUser')) {
|
||||
welcomeUserDidChange: Ember.observer('controller.welcomeUser', function() {
|
||||
if (this.get('controller.welcomeUser')) {
|
||||
Ember.run.scheduleOnce('afterRender', this, function() {
|
||||
this.$('.signup-welcome').addClass('in');
|
||||
this.$('.signup-welcome').hide().fadeIn();
|
||||
});
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user