Sha256: 2d9c7fad46c7d08a045bf3c2ad9e8e741e141d2412fcd3b8bd9a078b86719932

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

(function($) {

  var $el = $('.element_editor[data-element-id="<%= @element.id %>"]');

  function removeTinyMCEs(ids) {
    for (var i = ids.length - 1; i >= 0; i--) {
      tinymce.get(ids[i]).remove();
    };
  }

  <% if @error %>

    $("#element_<%= @element.id -%> .spinner").replaceWith("<span class='error_icon' title='<%= @error -%>'>!</span>");

  <% else %>

    $el.replaceWith('<%= escape_javascript render(:partial => "element", :object => @element) -%>');
    $el = $('#element_<%= @element.id %>');
    $('#element_area .sortable_cell').sortable('refresh');
    Alchemy.ElementEditors.reinit($el);

    <% if @element.folded %>

      <% if @element.rtf_contents.any? %>
        removeTinyMCEs(<%=raw @element.rtf_contents.collect(&:form_field_id).to_json %>);
      <% end %>

    <% else %>

      $el.trigger('Alchemy.SelectElementEditor');
      Alchemy.SelectBox($el);

      <% @element.rtf_contents.each do |content| %>
        Alchemy.Tinymce.addEditor('<%= content.form_field_id -%>');
      <% end %>

      Alchemy.GUI.initElement($el);

    <% end %>

  <% end %>

})(jQuery);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alchemy_cms-2.6.3 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.6.2.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.6.2 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.6.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.6.0 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.6.0.rc5 app/views/alchemy/admin/elements/fold.js.erb