Sha256: f8f26bd816da5fce0a35b75379170722631475e3f6b11f841d180a9206fcfb35

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

(function() {
  var $el;
  var $element_area;
  var element_html = '<%= escape_javascript render(:partial => "element", :object => @element, :locals => {: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('<%= _t(:main_content) %>');
  }
  Alchemy.selectOrCreateCellTab('<%= @cell_name -%>', '<%= @cell.nil? ? _t(:main_content) : @cell.name_for_label -%>');
<%- end -%>

  $element_area = $('#cell_<%= @cell_name -%>');

<%- 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('<%= _t(:successfully_added_element) -%>');
  Alchemy.closeCurrentWindow();
  Alchemy.Tinymce.init(<%= @element.richtext_contents_ids.to_json %>);
  Alchemy.PreviewWindow.refresh();
  Alchemy.ElementEditors.init();

  $el = $('#element_<%= @element.id -%>');
  $el.trigger('Alchemy.SelectElementEditor');
  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-2.9.1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.9.0 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.8.3 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.7.5 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.7.4 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.8.2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.8.1 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.7.3 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.7.2 app/views/alchemy/admin/elements/create.js.erb
alchemy_cms-2.7.1 app/views/alchemy/admin/elements/create.js.erb