Sha256: 01cb7c91f9faba6ad07dcf744f231d93843f0ab15264c785c411aa5a486f0e46

Contents?: true

Size: 1.62 KB

Versions: 10

Compression:

Stored size: 1.62 KB

Contents

(function() {
  var $el;
  var $element_area;
  var element_html = '<%= j render("element", element: @element, draggable: true) %>';

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

<%- if @page.can_have_cells? -%>
  if ($('#cells').length == 0) {
    Alchemy.buildTabbedCells('<%= Alchemy.t(:main_content) %>');
  }
  Alchemy.selectOrCreateCellTab('<%= @cell_name %>', '<%= @cell.nil? ? Alchemy.t(:main_content) : @cell.name_for_label %>');
<%- end -%>

<%- if @element.parent_element -%>
  $element_area = $('#element_<%= @element.parent_element_id %> > .nestable-elements > .nested-elements');
<%- else -%>
  $element_area = $('#cell_<%= @cell_name %>');
<%- end -%>

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

  if ($element_area.find('.element-editor').length > 0) {
    Alchemy.SortableElements(<%= @page.id %>, '<%= form_authenticity_token %>', $element_area);
  } else {
    $element_area.sortable('refresh');
  }

  Alchemy.growl('<%= Alchemy.t(:successfully_added_element) %>');
  Alchemy.closeCurrentDialog();
  Alchemy.Tinymce.init(<%= @element.richtext_contents_ids.to_json %>);
  Alchemy.PreviewWindow.refresh(function() {
    Alchemy.ElementEditors.selectElementInPreview(<%= @element.id %>);
  });

  $el = $('#element_<%= @element.id %>');
  $el.trigger('FocusElementEditor.Alchemy');
  Alchemy.GUI.initElement($el);

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

  <%= update_essence_select_elements(@page, @element) -%>
})();

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
alchemy_cms-3.4.2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.4.1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.3 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.4.0 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.4.0.rc1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.0 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.0.rc2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-3.3.0.rc1 app/views/alchemy/admin/elements/create.js.erb