framework/ember/app/components/discussion/post-header/toggle.js
Toby Zerner ffef6af403 Fix up bug with the way we hide list items
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.
2015-02-10 19:55:22 +10:30

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');
}
}
});