framework/ember/app/helpers/post-content.js

15 lines
582 B
JavaScript
Raw Normal View History

2014-12-20 14:26:46 +08:00
import Ember from 'ember';
// This helper takes a post as its argument and renders a certain component
// corresponding to the post's type. The naming convention is 'post-type-[type]'
// (for example, post-type-comment for a comment.) Other arguments added to the
// helper are passed through to the component.
export default Ember.Handlebars.makeBoundHelper(function(post, options) {
options.hash.post = post;
var component = 'post-type-'+post.get('type');
var helper = Ember.Handlebars.resolveHelper(options.data.view.container, component);
helper.call(this, options);
});