mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Work on composer, early implementation of replying
This commit is contained in:
@@ -4,35 +4,65 @@ export default Ember.View.extend({
|
||||
|
||||
classNames: ['composer'],
|
||||
|
||||
// classNameBindings: ['controller.showing:showing'],
|
||||
classNameBindings: ['controller.showing:showing', 'controller.minimized:minimized', 'active'],
|
||||
|
||||
// showingChanged: function() {
|
||||
// if (this.$()) {
|
||||
// var view = this;
|
||||
// this.$().animate({bottom: this.get('controller.showing') ? 20 : -this.$().height()}, 'fast', function() {
|
||||
// if (view.get('controller.showing')) {
|
||||
// $(this).find('textarea').focus();
|
||||
// }
|
||||
// });
|
||||
// $('#body').animate({marginBottom: this.get('controller.showing') ? this.$().height() + 20 : 0}, 'fast');
|
||||
// }
|
||||
// }.observes('controller.showing'),
|
||||
showingChanged: function() {
|
||||
if (! this.$()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// panePinnedChanged: function() {
|
||||
// if (this.$()) {
|
||||
// var discussions = this.get('controller.controllers.discussions');
|
||||
// var $this = this.$();
|
||||
// Ember.run.scheduleOnce('afterRender', function() {
|
||||
// var discussion = $('.discussion-pane');
|
||||
// var width = discussion.length ? discussion.offset().left : $('#body').offset().left;
|
||||
// $this.css('left', width);
|
||||
// });
|
||||
// }
|
||||
// }.observes('controller.controllers.discussions.paned', 'controller.controllers.discussions.panePinned'),
|
||||
var view = this;
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
view.$().css('bottom', view.get('controller.showing') ? -view.$().outerHeight() : 0);
|
||||
view.$().animate({bottom: view.get('controller.showing') ? 0 : -view.$().outerHeight()}, 'fast', function() {
|
||||
if (view.get('controller.showing')) {
|
||||
Ember.$(this).find('textarea').focus();
|
||||
}
|
||||
});
|
||||
view.updateBottomPadding();
|
||||
});
|
||||
}.observes('controller.showing'),
|
||||
|
||||
minimizedChanged: function() {
|
||||
if (! this.$() || ! this.get('controller.showing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var view = this;
|
||||
var oldHeight = this.$().height();
|
||||
Ember.run.scheduleOnce('afterRender', function() {
|
||||
var newHeight = view.$().height();
|
||||
view.updateBottomPadding();
|
||||
view.$().css('height', oldHeight).animate({height: newHeight}, 'fast', function() {
|
||||
view.$().css('height', '');
|
||||
if (! view.get('controller.minimized')) {
|
||||
view.$('textarea').focus();
|
||||
}
|
||||
});
|
||||
});
|
||||
}.observes('controller.minimized'),
|
||||
|
||||
didInsertElement: function() {
|
||||
// this.showingChanged();
|
||||
// this.panePinnedChanged();
|
||||
this.showingChanged();
|
||||
this.minimizedChanged();
|
||||
|
||||
var controller = this.get('controller');
|
||||
this.$('.composer-content').click(function() {
|
||||
if (controller.get('minimized')) {
|
||||
controller.send('show');
|
||||
}
|
||||
});
|
||||
|
||||
var view = this;
|
||||
this.$('textarea').focus(function() {
|
||||
view.set('active', true);
|
||||
}).blur(function() {
|
||||
view.set('active', false);
|
||||
});
|
||||
},
|
||||
|
||||
updateBottomPadding: function() {
|
||||
Ember.$('#main').animate({paddingBottom: this.get('controller.showing') ? this.$().outerHeight() - Ember.$('#footer').outerHeight(true) : 0}, 'fast');
|
||||
}
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user