mirror of
https://github.com/flarum/framework.git
synced 2025-01-10 04:53:53 +08:00
ffef6af403
If we use an #unless condition, then when the view is removed from the template, it is destroyed, and cannot be inserted again. So we’ll just keep the item there the whole time, and toggle its visibility with CSS.
23 lines
621 B
JavaScript
23 lines
621 B
JavaScript
import Ember from 'ember';
|
|
|
|
var precompileTemplate = Ember.Handlebars.compile;
|
|
|
|
/**
|
|
Component for the toggle button in a post header. Toggles the
|
|
`parent.revealContent` property when clicked. Only displays if the supplied
|
|
post is not hidden.
|
|
*/
|
|
export default Ember.Component.extend({
|
|
tagName: 'li',
|
|
classNameBindings: ['hidden'],
|
|
layout: precompileTemplate('<a href="#" class="btn btn-default btn-more" {{action "toggle"}}>{{fa-icon "ellipsis-h"}}</a>'),
|
|
|
|
hidden: Ember.computed.not('post.isHidden'),
|
|
|
|
actions: {
|
|
toggle: function() {
|
|
this.toggleProperty('parent.revealContent');
|
|
}
|
|
}
|
|
});
|