Sha256: b4b235fb89a09e513739d77ab3cb8a304a6c0ce02d419ac7a17a446615254b3a

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 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 -%>

<% if @element.fixed? %>
  Alchemy.SortableElements('[name="fixed-element-<%= @element.id %>"] .nested-elements');
<% end %>

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
alchemy_cms-7.1.3 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.0 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.0.pre.rc1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.0.pre.b2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-7.1.0.pre.b1 app/views/alchemy/admin/elements/create.js.erb