From 30f522b3d5cd5704fa8b38fdc4158fa0c319986f Mon Sep 17 00:00:00 2001
From: Thomas von Deyen <thomas@vondeyen.com>
Date: Tue, 8 May 2018 09:30:59 +0200
Subject: [PATCH] Fix draggable trash item feature

Since the introduction of the nested elements feature this is broken, because the necessary `data-droppable-elements` attribute was missing on the "main content" cell div and had a duplicated `data-data` on the cells div.
---
 app/views/alchemy/admin/elements/index.html.erb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/views/alchemy/admin/elements/index.html.erb b/app/views/alchemy/admin/elements/index.html.erb
index fbdc2c38a0..eff4e59b8f 100644
--- a/app/views/alchemy/admin/elements/index.html.erb
+++ b/app/views/alchemy/admin/elements/index.html.erb
@@ -10,7 +10,9 @@
         </li>
       <% end %>
     </ul>
-    <div id="cell_for_other_elements" class="sortable_cell for_other_elements_cell">
+    <div id="cell_for_other_elements"
+      class="sortable_cell for_other_elements_cell"
+      data-droppable-elements="<%= @page.element_names_from_definition.join(' ') %>">
       <%= render partial: 'alchemy/admin/elements/element',
         collection: @page.elements.not_trashed.not_in_cell %>
     </div>
@@ -18,7 +20,7 @@
       <%= content_tag :div,
         id: "cell_#{cell.name}",
         class: ["sortable_cell", "#{cell.name}_cell"].join(' '),
-        data: {'cell-id' => cell.id, 'data-droppable-elements' => cell.element_definitions.join(' ')} do %>
+        data: {'cell-id' => cell.id, 'droppable-elements' => cell.element_definitions.join(' ')} do %>
         <%= render partial: 'alchemy/admin/elements/element', collection: elements %>
       <% end %>
     <% end %>