Is there a way to dynamically introduce partial patterns (and work the same way in Ruby and Javascript)? Basically, I am trying to display various types of objects in a list.
The best I can come up with is this:
<div class="items"> {{#items}} <div class="item"> {{#is_message}} {{> message}} {{/is_message}} {{#is_picture}} {{> picture}} {{/is_picture}} </div> {{/items}} </div>
I do not know much about this approach. Is there a better way?
Also note that different types of models for views may have different fields. I believe that I could always go to the lowest common denominator and have a data hash containing html, however I would prefer to use mustache patterns.
javascript ruby templates partial-views
Brian takita
source share