Skip to content

Commit 42b7601

Browse files
committed
fix(page tree): Use edit link in top frame
The turbo frame that displays the pages tree needs to be fully replaced by the edit pages window. (cherry picked from commit ffe09be)
1 parent 114702f commit 42b7601

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

app/components/alchemy/admin/page_node.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
@page.name,
5353
url(:edit_page),
5454
title: t(:edit_page),
55-
class: "sitemap_pagename_link"
55+
class: "sitemap_pagename_link",
56+
"data-turbo-frame": "_top"
5657
) %>
5758
<% else %>
5859
<%= content_tag("span", @page.name, class: "sitemap_pagename_link") %>

spec/features/admin/page_editing_feature_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@
3939
expect(page).to have_select("preview_url", options: ["Internal", "Foo Preview"])
4040
end
4141
end
42+
43+
context "in pages tree" do
44+
let!(:a_page) { create(:alchemy_page) }
45+
46+
describe "clicking the page name" do
47+
it "opens the page in edit mode", :js do
48+
visit alchemy.admin_pages_path(view: "tree")
49+
within ".sitemap_page[name='#{a_page.name}']" do
50+
click_link a_page.name
51+
end
52+
expect(page).to have_current_path("/admin/pages/#{a_page.id}/edit")
53+
end
54+
end
55+
end
4256
end
4357

4458
context "as editor" do

0 commit comments

Comments
 (0)