Skip to content

Commit

Permalink
Reload page tree after parents changes
Browse files Browse the repository at this point in the history
This is more reliable than just replacing the old and the new parents
  • Loading branch information
tvdeyen committed Mar 5, 2022
1 parent 9fa4178 commit 35ef102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/alchemy/admin/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def configure
def update
# stores old page_layout value, because unfurtunally rails @page.changes does not work here.
@old_page_layout = @page.page_layout
@old_parent_id = @page.parent_id
if @page.update(page_params)
@notice = Alchemy.t("Page saved", name: @page.name)
@while_page_edit = request.referer.include?("edit")
Expand Down
7 changes: 7 additions & 0 deletions app/views/alchemy/admin/pages/update.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
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) {
Expand Down

0 comments on commit 35ef102

Please sign in to comment.