more bulk editor work

This commit is contained in:
Dan Elbert 2016-01-30 21:35:39 -06:00
parent 3ca786281d
commit edfd6f12d6
2 changed files with 7 additions and 5 deletions

View File

@ -173,7 +173,9 @@
initializeStepEditor(item); initializeStepEditor(item);
}) })
.on("cocoon:after-remove", function(e, item) { .on("cocoon:after-remove", function(e, item) {
if (item.find(".remove-button.existing").length) {
item.detach().appendTo("#deleted_steps"); item.detach().appendTo("#deleted_steps");
}
reorder($(this)); reorder($(this));
}) })
.on('changed', 'input.sort_order', function() { .on('changed', 'input.sort_order', function() {
@ -191,7 +193,9 @@
initializeIngredientEditor(item, ingredientSearchEngine); initializeIngredientEditor(item, ingredientSearchEngine);
}) })
.on("cocoon:after-remove", function(e, item) { .on("cocoon:after-remove", function(e, item) {
if (item.find(".remove-button.existing").length) {
item.detach().appendTo("#deleted_ingredients"); item.detach().appendTo("#deleted_ingredients");
}
reorder($ingredientList); reorder($ingredientList);
}) })
.on("typeahead:change", function(evt, value) { .on("typeahead:change", function(evt, value) {

View File

@ -15,7 +15,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<% if current_user? %> <% if current_user? %>
<th colspan="2"></th> <th></th>
<% end %> <% end %>
<th>Yields</th> <th>Yields</th>
<th>Time</th> <th>Time</th>
@ -34,8 +34,6 @@
<%= link_to edit_recipe_path(recipe), class: 'btn btn-sm btn-primary' do %> <%= link_to edit_recipe_path(recipe), class: 'btn btn-sm btn-primary' do %>
<span class="glyphicon glyphicon-pencil"></span> <span class="glyphicon glyphicon-pencil"></span>
<% end %> <% end %>
</td>
<td>
<%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do %> <%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do %>
<span class="glyphicon glyphicon-remove"></span> <span class="glyphicon glyphicon-remove"></span>
<% end %> <% end %>