Picture of Tom Baum
handlebars partials
by Tom Baum - Friday, 25 September 2015, 9:24 AM
 

hi folks,

can I use handlebars-partials in componentView and if so, can you please give me a short example how to do it?

Thanks in advance,

Tom

Picture of Tom Taylor
Re: handlebars partials
by Tom Taylor - Thursday, 1 October 2015, 8:55 AM
 

Hi Tom,

There's already a components.hbs partial in contrib-vanilla for displaying component title/body/instruction which can modified. What is it that you're looking to do?

Picture of Tom Baum
Re: handlebars partials
by Tom Baum - Tuesday, 20 October 2015, 4:01 PM
 

Hi Tom,

thanks for your reply and sorry for my delayed response.
What I want to do is to substitute the question-texts of some standard components (e.g. multiple-choice) with audio. For this, I developed a small audio-plugin based on jPlayer which merely displays two buttons (a play/pause- and a stop-button). I'd like to serve this player as handlebars-partial and integrate it into the given component, as above-mentioned. Despite I'm absolute new to backbone and handlebars, I managed to deal with partials in standard handlebars-templates (with its script-tags, Handlebars.registerPartial etc.), but the mechanism seems to be different in adapt-framework. So, here are my questions:

1. Do I have to name the partial? Normaly this is done by give an id-argument in the script-tag of the partial itself, but in adapt-handlebars-templates there are no script-tags at all. How do I name the partial in adapt? Do I have to store the partial in a certain folder?

2. Do I have to register the partial in ComponentView.extend or elsewhere and if so, how?

Regards, Tom

Picture of Tom Taylor
Re: handlebars partials
by Tom Taylor - Thursday, 22 October 2015, 2:39 PM
 

Looking at the handlebars config in the Gruntfile, the handlebars process assumes any .hbs file found in a 'partials' folder within the components, extensions, menu or theme folders is a handlebars partial.

The quickest and easiest way to do this would be to drop the partial .hbs file into your theme (src/THEME/templates/partials/)

Alternatively, you can create an extension to house your partials. Simply including a 'partials' folder with the relevant .hbs files in the root of your extension should do the trick here.

Let me know how you get on :)

Picture of Tom Baum
Re: handlebars partials
by Tom Baum - Tuesday, 10 November 2015, 9:43 AM
 

Hi Tom,

I' ve got it. Thank you!

 

Regards,

Tom