Skip to content

Instantly share code, notes, and snippets.

@rcy
Created June 27, 2013 08:28
Show Gist options
  • Save rcy/5874878 to your computer and use it in GitHub Desktop.
Save rcy/5874878 to your computer and use it in GitHub Desktop.
compute a template to render
Template.editProperty.helpers({
// Render a template based on the control type. For example, if
// this.control.type is 'color', it will render the template with
// name="colorControl", if it exists. 'this' context is passed to
// the control sub-template when rendering.
renderControl: function() {
if ( ! (this.control && this.control.type))
throw new Meteor.Error(500, 'type missing');
var template = Template[this.control.type + 'Control'];
if (template)
return new Handlebars.SafeString(template(this));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment