mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
UX: slide in animation for login/signup modals
This commit is contained in:
parent
90de61ee3d
commit
75705f3a98
3 changed files with 28 additions and 15 deletions
|
@ -157,20 +157,21 @@ const ApplicationRoute = Discourse.Route.extend({
|
||||||
const returnPath = encodeURIComponent(window.location.pathname);
|
const returnPath = encodeURIComponent(window.location.pathname);
|
||||||
window.location = Discourse.getURL('/session/sso?return_path=' + returnPath);
|
window.location = Discourse.getURL('/session/sso?return_path=' + returnPath);
|
||||||
} else {
|
} else {
|
||||||
this._autoLogin('login', () => this.controllerFor('login').resetForm());
|
this._autoLogin('login', 'login-modal', () => this.controllerFor('login').resetForm());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleShowCreateAccount() {
|
handleShowCreateAccount() {
|
||||||
this._autoLogin('createAccount');
|
this._autoLogin('createAccount', 'create-account');
|
||||||
},
|
},
|
||||||
|
|
||||||
_autoLogin(modal, notAuto) {
|
_autoLogin(modal, modalClass, notAuto) {
|
||||||
const methods = Em.get('Discourse.LoginMethod.all');
|
const methods = Em.get('Discourse.LoginMethod.all');
|
||||||
if (!this.siteSettings.enable_local_logins && methods.length === 1) {
|
if (!this.siteSettings.enable_local_logins && methods.length === 1) {
|
||||||
this.controllerFor('login').send('externalLogin', methods[0]);
|
this.controllerFor('login').send('externalLogin', methods[0]);
|
||||||
} else {
|
} else {
|
||||||
showModal(modal);
|
showModal(modal);
|
||||||
|
this.controllerFor('modal').set('modalClass', modalClass);
|
||||||
if (notAuto) { notAuto(); }
|
if (notAuto) { notAuto(); }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
<div class="modal-outer-container">
|
<div class="modal-outer-container">
|
||||||
<div class="modal-middle-container">
|
<div class="modal-middle-container">
|
||||||
<div class="modal-inner-container">
|
<div class="modal-inner-container">
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<a class="close" {{action "closeModal"}}><i class='fa fa-times'></i></a>
|
<a class="close" {{action "closeModal"}}>{{fa-icon "times"}}</a>
|
||||||
<h3>{{title}}</h3>
|
<h3>{{title}}</h3>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id='modal-alert'></div>
|
<div id='modal-alert'></div>
|
||||||
|
|
||||||
{{outlet "modalBody"}}
|
{{outlet "modalBody"}}
|
||||||
|
|
||||||
{{#each error in errors}}
|
{{#each error in errors}}
|
||||||
<div class="alert alert-error">
|
<div class="alert alert-error">
|
||||||
<button class="close" data-dismiss="alert">×</button>
|
<button class="close" data-dismiss="alert">×</button>
|
||||||
{{error}}
|
{{error}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// fade in
|
// fade in
|
||||||
|
|
||||||
@keyframes fade {
|
@keyframes fade {
|
||||||
from { opacity: 0 }
|
from { opacity: 0 }
|
||||||
to { opacity: .9 }
|
to { opacity: .9 }
|
||||||
|
@ -44,6 +43,17 @@
|
||||||
to { opacity: .9 }
|
to { opacity: .9 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// slide in
|
||||||
|
@keyframes slidein {
|
||||||
|
from { transform: translateY(-20%); }
|
||||||
|
to { transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes slidein {
|
||||||
|
from { transform: translateY(-20%); }
|
||||||
|
to { transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
.modal-outer-container {
|
.modal-outer-container {
|
||||||
display:table;
|
display:table;
|
||||||
width:100%;
|
width:100%;
|
||||||
|
@ -61,6 +71,12 @@
|
||||||
background-clip: padding-box;
|
background-clip: padding-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.create-account.in .modal-inner-container,
|
||||||
|
.login-modal.in .modal-inner-container {
|
||||||
|
-webkit-animation: slidein .3s;
|
||||||
|
animation: slidein .3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
Loading…
Reference in a new issue