app/views/alchemy/admin/elements/create.js.erb in alchemy_cms-2.1.5 vs app/views/alchemy/admin/elements/create.js.erb in alchemy_cms-2.1.6

- old
+ new

@@ -1,7 +1,9 @@ (function($) { + var $el; + <% if @cutted_element_id %> $('.element_editor[data-element-id="<%= @cutted_element_id %>"]').remove(); <% end %> <%- if @page.can_have_cells? -%> @@ -17,14 +19,16 @@ Alchemy.Tinymce.addEditor('<%= content.form_field_id -%>'); <%- end -%> Alchemy.PreviewWindow.refresh(); Alchemy.ElementEditorSelector.init(); - $('.element_editor[data-element-id="<%= @element.id -%>"]').trigger('Alchemy.SelectElementEditor'); - Alchemy.ElementDirtyObserver('#element_<%= @element.id -%>'); - Alchemy.SelectBox('#element_<%= @element.id -%> select'); - Alchemy.ButtonObserver('#element_<%= @element.id -%> button.button'); - Alchemy.Datepicker('#element_<%= @element.id -%> input[type="date"]'); + + $el = $('#element_<%= @element.id -%>'); + $el.trigger('Alchemy.SelectElementEditor'); + Alchemy.ElementDirtyObserver($el); + Alchemy.SelectBox('select', $el); + Alchemy.ButtonObserver('button.button', $el); + Alchemy.Datepicker('input[type="date"]', $el); <%- if @clipboard.blank? -%> $('#clipboard_button .icon.clipboard').removeClass('full'); <%- end -%>