1
0
mirror of https://github.com/flarum/core.git synced 2025-08-01 14:10:37 +02:00

Signup + modal refactoring

This commit is contained in:
Toby Zerner
2015-02-08 15:59:39 +10:30
parent 6c3debc79b
commit d45f2fd1ac
14 changed files with 193 additions and 69 deletions

View File

@@ -26,6 +26,16 @@ export default Ember.View.extend({
return this.get('controller.forumTitle');
}.property('controller.forumTitle'),
modalShowingChanged: function() {
if (!this.$()) { return; }
if (this.get('controller.modalController')) {
this.$('#modal').modal('show');
} else {
this.$('#modal').modal('hide');
}
}.observes('controller.modalController'),
didInsertElement: function() {
@@ -44,6 +54,15 @@ export default Ember.View.extend({
$(window).resize(function() {
$('#main').css('min-height', $(window).height() - $('#header').outerHeight() - $('#footer').outerHeight(true));
}).resize();
var view = this;
this.$('#modal').on('hide.bs.modal', function() {
view.get('controller').send('closeModal');
}).on('hidden.bs.modal', function() {
view.get('controller').send('destroyModal');
}).on('shown.bs.modal', function() {
view.get('controller.modalController').send('focus');
});
},
switchHeader: function() {
@@ -106,7 +125,10 @@ export default Ember.View.extend({
} else {
var signUp = ActionButton.create({
label: 'Sign Up',
className: 'btn btn-link'
className: 'btn btn-link',
action: function() {
controller.send('signup');
}
});
secondary.pushObjectWithTag(signUp, 'signUp');