Sha256: 9281c3b8575ebebdbe4e54e0cad48cfbf0071950cf8f0a1c3ee8165e609b694a

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

(function() {
  var $element_area;
  var element_html = '<%= j render(Alchemy::ElementEditor.new(@element)) %>';

<%- if @cut_element_id -%>
  $('.element-editor[data-element-id="<%= @cut_element_id %>"]').remove();
<%- end -%>

<% if @element.fixed? %>
  if ($('#fixed-elements').length == 0) {
    Alchemy.FixedElements.buildTabs('<%= Alchemy.t(:main_content) %>');
  }
  Alchemy.FixedElements.createTab('<%= @element.id %>', '<%= @element.display_name %>');
  $element_area = $('[name="fixed-element-<%= @element.id %>"]');
<% elsif @element.parent_element %>
  $element_area = $('#element_<%= @element.parent_element_id %> > .nestable-elements > .nested-elements');
<% else %>
  $element_area = $('#main-content-elements');
<% end %>

<%- if @insert_at_top -%>
  $element_area.prepend(element_html);
<%- else -%>
  $element_area.append(element_html);
<%- end -%>

  Alchemy.SortableElements('[data-element-id="<%= @element.id %>"] .nested-elements');

  Alchemy.growl('<%= Alchemy.t(:successfully_added_element) %>');
  Alchemy.closeCurrentDialog();
  Alchemy.reloadPreview();

  el = document.querySelector('#element_<%= @element.id %>');
  el.focusElement();
  el.focusElementPreview();

<%- if @clipboard.blank? -%>
  $('#clipboard_button .icon.clipboard').removeClass('full');
<%- end -%>
})();

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alchemy_cms-7.1.12 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.11 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.10 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.9 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.8 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.7 app/views/alchemy/admin/elements/create.js.erb