Sha256: 255e4fc476eecc8b53d56e87ead02c7b1541c3db53c625d15c52233f5b26df98

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

(function() {
  var $el = $('#element_<%= @element.id %>');
  var $errors = $('#element_<%= @element.id %>_errors');
  $('> .element-content .content_editor, > .element-content .ingredient-editor', $el).removeClass('validation_failed');

<%- if @element_validated -%>

  $errors.hide();
  $el.trigger('SaveElement.Alchemy', {previewText: '<%= j sanitize(@element.preview_text) %>'});
  Alchemy.growl('<%= Alchemy.t(:element_saved) %>');
  Alchemy.PreviewWindow.refresh(function() {
    Alchemy.ElementEditors.focusElementPreview(<%= @element.id %>);
  });

<%- else -%>

  Alchemy.growl('<%= j @notice %>', 'warn');
  $errors.html('<%= j @error_message %><ul><li><%== j @error_messages.join("</li><li>") %></li></ul>');
  $errors.show();
  $('<%= @element.contents_with_errors.map { |content| "#" + content.dom_id }.join(", ") %>').addClass('validation_failed');
  $('<%== @element.ingredients_with_errors.map { |ingredient| "[data-ingredient-id=\"#{ingredient.id}\"]" }.join(", ") %>').addClass('validation_failed');
  Alchemy.Buttons.enable($el);

<%- end -%>
})();

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
alchemy_cms-6.0.14 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.13 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.12 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.11 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.10 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.9 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.8 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.7 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.6 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.5 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.4 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.3 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.2 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.1 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0.pre.rc7 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0.pre.rc6 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0.pre.rc5 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0.pre.rc4 app/views/alchemy/admin/elements/update.js.erb
alchemy_cms-6.0.0.pre.rc3 app/views/alchemy/admin/elements/update.js.erb