Sha256: 5de04bb872bc90b9e7f881311458cf12b0175f2ef3adad56e54644ed38a32134

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

(function() {
  var page = document.querySelector('#page_<%= @page.id %>');

<% if @old_page_layout != @page.page_layout -%>
  Alchemy.ElementsWindow.reload();
  Alchemy.growl('<%= j Alchemy.t(:page_layout_changed_notice) %>');
<% end -%>

<% if @while_page_edit -%>

  Alchemy.reloadPreview();
  document.querySelector('#page_<%= @page.id %>_status').outerHTML = '<%= j render("current_page", current_page: @page) %>';
  Alchemy.growl("<%= j @notice %>");
  Alchemy.closeCurrentDialog();

<% elsif @page.parent_id != @old_parent_id -%>

  Alchemy.closeCurrentDialog(function() {
    Alchemy.growl("<%= j @notice %>");
    Alchemy.currentSitemap.load(<%= @page.get_language_root.id %>);
  });

<% else -%>

  if (page) {
    var page_html = "<%= j render('page', page: @page) %>".replace(/__ID__/g, "<%= @page.id %>");;
    var compiler = Handlebars.compile(page_html);
    var tree = <%== @tree.to_json %>;
    page.outerHTML = compiler(tree.pages[0]);
    Alchemy.growl("<%= j @notice %>");
    Alchemy.closeCurrentDialog();
  } else {
    document.addEventListener('turbolinks:load', function () {
      Alchemy.growl("<%= j @notice %>");
    }, { once: true })
    Alchemy.closeCurrentDialog(function() {
      Turbolinks.visit(location.toString(), { action: "replace" });
    });
  }

<% end -%>
})()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alchemy_cms-5.3.8 app/views/alchemy/admin/pages/update.js.erb
alchemy_cms-5.3.7 app/views/alchemy/admin/pages/update.js.erb