I'm currently in the process of developing my cookbook app and the next feature on my agenda is the grocery list functionality. Once on the recipe page, users will have the option to click on an "Add to Grocery List" link which will redirect them to a page containing all the ingredients needed for that particular recipe.
The idea is to display the ingredients individually, each with a checkbox next to it. My goal is to have a strikethrough effect applied to the ingredient text when the checkbox is ticked (Eggs), and for the text to remain normal when the checkbox is unticked. This is where I could really use some assistance. I understand that I will need to use If statements, but I'm unsure of how to implement them while achieving the desired outcome.
Currently, I have the ingredients stored using the text_area method, meaning that in order to distinguish between ingredients, the each_line function must be utilized.
Here is a snippet from the _grocery partial that I have constructed:
<% @recipe.ingredient.each_line do |line| %>
<li><%= line %></li>
<% end %>
Since I am not using bootstrap, I am unsure of how to incorporate the checkbox and apply the strikethrough effect when the checkbox is selected. Any guidance or insights would be greatly appreciated. If additional code is required from my end, please do not hesitate to request it.
This particular aspect of the project has me feeling a bit out of my depth.