mirror of
https://github.com/flarum/core.git
synced 2025-08-02 14:37:49 +02:00
Animate user card popovers
This commit is contained in:
@@ -7,7 +7,7 @@ var precompileTemplate = Ember.Handlebars.compile;
|
|||||||
*/
|
*/
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
classNames: ['post-user'],
|
classNames: ['post-user'],
|
||||||
layout: precompileTemplate('{{#if post.user}}<h3>{{#link-to "user" post.user}}{{user-avatar post.user}} {{user-name post.user}}{{/link-to}} {{ui/item-list items=post.user.badges class="badges"}}</h3>{{#if showCard}}{{user/user-card user=post.user class="user-card-popover" controlsButtonClass="btn btn-default btn-icon btn-sm btn-naked"}}{{/if}}{{else}}<h3>{{user-avatar post.user}} {{user-name post.user}}</h3>{{/if}}'),
|
layout: precompileTemplate('{{#if post.user}}<h3>{{#link-to "user" post.user}}{{user-avatar post.user}} {{user-name post.user}}{{/link-to}} {{ui/item-list items=post.user.badges class="badges"}}</h3>{{#if showCard}}{{user/user-card user=post.user class="user-card-popover fade" controlsButtonClass="btn btn-default btn-icon btn-sm btn-naked"}}{{/if}}{{else}}<h3>{{user-avatar post.user}} {{user-name post.user}}</h3>{{/if}}'),
|
||||||
|
|
||||||
didInsertElement: function() {
|
didInsertElement: function() {
|
||||||
var component = this;
|
var component = this;
|
||||||
@@ -16,11 +16,16 @@ export default Ember.Component.extend({
|
|||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(function() {
|
timeout = setTimeout(function() {
|
||||||
component.set('showCard', true);
|
component.set('showCard', true);
|
||||||
|
Ember.run.scheduleOnce('afterRender', function() {
|
||||||
|
Ember.run.next(function() { component.$('.user-card').addClass('in'); });
|
||||||
|
});
|
||||||
}, 250);
|
}, 250);
|
||||||
}).bind('mouseout', '> a, .user-card', function() {
|
}).bind('mouseout', '> a, .user-card', function() {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(function() {
|
timeout = setTimeout(function() {
|
||||||
component.set('showCard', false);
|
component.$('.user-card').removeClass('in').one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function() {
|
||||||
|
component.set('showCard', false);
|
||||||
|
});
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -191,8 +191,12 @@
|
|||||||
& .user-card {
|
& .user-card {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 100%;
|
top: 100%;
|
||||||
margin-top: 5px;
|
|
||||||
z-index: @zindex-popover;
|
z-index: @zindex-popover;
|
||||||
|
.transition(~"opacity 0.2s, margin-top 0.2s");
|
||||||
|
|
||||||
|
&.in {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user