Sha256: 344e3a17f031d2ec35dfa4c778b60471efe4db3f914134259625e2b8b0ac0523

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 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 -%>_folder_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.ElementEditorSelector.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.ElementDirtyObserver($el);
      Alchemy.Datepicker('input[type="date"]', $el);
      Alchemy.Buttons.observe($el);
      Alchemy.overlayObserver("#element_<%= @element.id -%>");

    <% end %>

  <% end %>

})(jQuery);

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
alchemy_cms-2.5.3.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.3 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.2.2 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.2.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.2 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.0 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.0.rc3 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.0.b9 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.0.b5 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.5.0.b2 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.0 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.rc4 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.rc2 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.rc1 app/views/alchemy/admin/elements/fold.js.erb
alchemy_cms-2.4.beta2 app/views/alchemy/admin/elements/fold.js.erb