Created
June 27, 2013 08:28
-
-
Save rcy/5874878 to your computer and use it in GitHub Desktop.
compute a template to render
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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