I’m using a similar code to the one in “Data Files” to parse data from a yaml file, so my code looks like this:
<% data.items.each do |item| %>
<h2><%= item.name %></h2>
<p><%= item.description %></p>
<% end %>
What I would like to do now, is for users to filter the items rendered, depending on if they contain certain value or not. For example, there would be a “Free” link, and it should hide the items that are not free.
The values from the yaml file look like this:
name: "Balsamiq"
description: "A rapid low-fidelity UI wireframing tool."
price: "free"
So items like this, should be shown and the rest hidden upon user’s action (then, filters would be multiple so user can choose several criteria at the same time.)
I’m a bit lost on how to continue from here, if this could be done directly on my template, or if I should relay on JavaScript.
I’ve been looking around on StackOverflow for a while now with not significant progress, so any pointers would be appreciated.