bjorn2404 / jQuery-Store-Locator-Plugin

A store locator plugin using Google Maps API version 3
MIT License
495 stars 235 forks source link

Addition of new handlebars filters #112

Closed christianrochford closed 8 years ago

christianrochford commented 8 years ago

More of a request than an issue. I need to create a nested json object within my locations file, however, the twig used within the project doesn't seem to allow for looping through a json array, e.g.

{% for category in categories %}
<a href="/category/{{ category.id }}" class="icon-{{ category.name }}"></a>
{% endfor %}

I'm quite new to twig so am not sure how this may be achieved. I've created my nested json object but have no way to output the data. I've found this option http://stackoverflow.com/questions/11841515/twig-iterate-over-object-properties but am not sure how to get the twig filter in place to allow for looping through the data. Thanks a lot!

bjorn2404 commented 8 years ago

I'm not sure if I'm interpreting correctly but this seems like more of a twig question. I'm not familiar with twig.

christianrochford commented 8 years ago

Sorry typo on my part, been using twig a lot lately, its a handlebars question https://github.com/bjorn2404/jQuery-Store-Locator-Plugin/blob/master/dist/assets/js/plugins/storeLocator/templates/location-list-description.html I'm trying to loop through a nested json object within this template

bjorn2404 commented 8 years ago

Ah, ok you'll probably want to look at the each block helper: http://handlebarsjs.com/builtin_helpers.html#iteration

christianrochford commented 8 years ago

Perfect, I've got that working now, thanks!