README.md in dom_for-1.1.0 vs README.md in dom_for-1.2.0
- old
+ new
@@ -22,25 +22,25 @@
$ gem install dom_for
## Usage
-By default the helper `dom_for` creates tag `div`. But it can override, passing an additional argument `tag`, for example: `dom _for User, tag: :span`:
+By default the helper `dom_for` creates tag `div`. But it can override, passing an additional argument `tag: :span`, for example:
```erb
<%# /app/views/users/index.html.erb %>
-<%= dom_for User, attribute_1: 'value_1', attribute_2: 'value_2', attribute_3: 'value_3' do %>
+<%= dom_for User, class: 'customers', attribute_1: 'value_1', attribute_2: 'value_2', attribute_3: 'value_3' do %>
<% @users.each do |user| %>
<%= dom_for user, tag: :p, admin: user.admin, blocked: user.blocked do %>
<%= content_tag(:span, user.name) %>
<% end %>
<% end %>
<% end %>
```
```html
-<div id="users" class="users" data-action="index" data-attribute-1="value_1" data-attribute-2="value_2" data-attribute-3="value_3">
+<div id="users" class="users customers" data-action="index" data-attribute-1="value_1" data-attribute-2="value_2" data-attribute-3="value_3">
<p id="user_1" class="user" data-admin="true" data-blocked="false" data-object-id="1">
<span>Mikhail</span>
</div>
<p id="user_2" class="user" data-admin="false" data-blocked="false" data-object-id="2">
<span>Yulia</span>
@@ -80,16 +80,16 @@
The second argument passed to additional html-attributes (is optional):
```erb
<%# /app/views/users/index.html.erb %>
-<%= dom_for User, attribute_1: 'value_1', attribute_2: 'value_2' do %>
+<%= dom_for User class: 'clients', attribute_1: 'value_1', attribute_2: 'value_2' do %>
<%= tag(:span) %>
<% end %>
```
```html
-<div id="users" class="users" data-action="index" data-attribute-1="value_1" data-attribute-2="value_2">
+<div id="users" class="users clients" data-action="index" data-attribute-1="value_1" data-attribute-2="value_2">
<span />
</div>
```
The third argument, the helper `dom_for`, takes a block of code that will be wrapped in the tag `<div>` (is optional):