2015-04-03 23:56:13 +02:00
|
|
|
<tr id="products_row_<%= dom_id(product) %>">
|
|
|
|
<%= f_form_for product, remote: true do |f| %>
|
|
|
|
<td><%= image_tag product.avatar(:small) %></td>
|
|
|
|
<td><%= f.text_field :name, skip_label: true %></td>
|
|
|
|
<td><%= f.price_field :price, skip_label: true %></td>
|
|
|
|
<td><%= f.number_field :stock, skip_label: true %></td>
|
2015-08-25 15:53:27 +02:00
|
|
|
<td><%= f.check_box :deleted, skip_label: true %></td>
|
2015-07-07 20:13:37 +02:00
|
|
|
<td><%= f.number_field :calories, skip_label: true %></td>
|
2015-04-03 23:56:13 +02:00
|
|
|
<td><%= f.button "Update", class: "btn btn-primary" %></td>
|
|
|
|
<%= javascript_tag do %>
|
|
|
|
var id = "#edit_<%= dom_id(product) %>";
|
|
|
|
var inputs = $(id).parent().find('input');
|
|
|
|
|
|
|
|
$(id).parent().find('button').on('click', function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$(id).append(inputs.clone());
|
|
|
|
$(id).append('<input type="hidden" name="_method" value="patch">');
|
|
|
|
$(id).submit();
|
|
|
|
});
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</tr>
|