Hi Core List
The usual way to conditionally add classes to html tags is in the following form:
This is hard to read and nod very convenient. ReactJS has an Addon to use a Hash (Javascript Object) to conditionally add classes (GitHub - JedWatson/classnames: A simple javascript utility for conditionally joining classNames together).
Inspired by this I’d like to add a helper to ActionView which does exactly that. So you can write:
or
<%= content_tag_for :tr, @model, class: class_list(‘foo’, ready: @model.ready?) do %>
How do you like this idea? Where should that go? New gem? The newly extracted content tag gem? Action View Helpers?
Regards
phil