<%= Alchemy.t('No menu node for this page found') %>
+
+
+ <% end %>
+
+
+
+
+
+<% end %>
+
+
diff --git a/app/views/alchemy/admin/nodes/create.html.erb b/app/views/alchemy/admin/nodes/create.html.erb
new file mode 100644
index 0000000000..8861fc5769
--- /dev/null
+++ b/app/views/alchemy/admin/nodes/create.html.erb
@@ -0,0 +1 @@
+<%= render "page_nodes" %>
diff --git a/app/views/alchemy/admin/nodes/destroy.html.erb b/app/views/alchemy/admin/nodes/destroy.html.erb
new file mode 100644
index 0000000000..8861fc5769
--- /dev/null
+++ b/app/views/alchemy/admin/nodes/destroy.html.erb
@@ -0,0 +1 @@
+<%= render "page_nodes" %>
diff --git a/app/views/alchemy/admin/pages/configure.html.erb b/app/views/alchemy/admin/pages/configure.html.erb
index e051a06769..648eda6cae 100644
--- a/app/views/alchemy/admin/pages/configure.html.erb
+++ b/app/views/alchemy/admin/pages/configure.html.erb
@@ -2,12 +2,18 @@
<%= Alchemy.t('Properties') %>
+
+ <%= render 'alchemy/admin/nodes/label', count: @page.nodes.size %>
+
<%= render 'alchemy/admin/legacy_page_urls/label', count: @page.legacy_urls.size %>
<%= render 'form' %>
+
+ <%= render 'alchemy/admin/nodes/page_nodes' %>
+
<%= render 'legacy_urls' %>
diff --git a/config/locales/alchemy.en.yml b/config/locales/alchemy.en.yml
index a5a51f2f11..888ca58819 100644
--- a/config/locales/alchemy.en.yml
+++ b/config/locales/alchemy.en.yml
@@ -250,6 +250,7 @@ en:
"Confirm new password": "Confirm new password"
"Copy": "Copy"
"Could not load Adobe Flash® Plugin!": "Could not load Adobe Flash® Plugin!"
+ "Create node on parent:": "Create node on parent:"
"Currently locked pages": "Currently locked pages"
"Default language has to be public": "Default language has to be public"
"Delete image": "Delete image"
@@ -286,6 +287,7 @@ en:
"New": "New"
"New Element": "New element"
"New page": "New page"
+ "No menu node for this page found": "No menu node for this page found"
"No page links for this page found": "No page links for this page found"
"New password": "New password"
"New Tag": "New tag"
@@ -411,6 +413,7 @@ en:
delete_node: "Delete this menu node"
delete_page: "Delete this page"
delete_tag: "Delete tag"
+ search_node: "Search menu node"
document: "File"
download_csv: "Download CSV"
download_file: "Download file '%{filename}'"
diff --git a/spec/components/alchemy/admin/node_select_spec.rb b/spec/components/alchemy/admin/node_select_spec.rb
index 40d4dba979..b9033d7ba4 100644
--- a/spec/components/alchemy/admin/node_select_spec.rb
+++ b/spec/components/alchemy/admin/node_select_spec.rb
@@ -16,7 +16,7 @@
end
it "should have the default placeholder" do
- expect(page).to have_selector("alchemy-node-select[placeholder='Search node']")
+ expect(page).to have_selector("alchemy-node-select[placeholder='Search menu node']")
end
it "should have the default node api - url" do
diff --git a/spec/features/admin/nodes_management_spec.rb b/spec/features/admin/nodes_management_spec.rb
new file mode 100644
index 0000000000..80dc581d2f
--- /dev/null
+++ b/spec/features/admin/nodes_management_spec.rb
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+RSpec.describe "Nodes management", type: :system, js: true do
+ before do
+ authorize_user(:as_admin)
+ end
+
+ let!(:a_page) { create(:alchemy_page) }
+ let!(:a_menu) { create(:alchemy_node, name: "Menu") }
+
+ def open_page_properties
+ visit admin_pages_path
+ expect(page.find("alchemy-overlay").style("display")["display"]).to have_content("none")
+ page.find("a[href='#{configure_admin_page_path(a_page)}']", wait: 10).click
+ find("[panel='nodes']").click
+ end
+
+ def add_menu_item
+ find("#new_node_form .select2-choice").click
+ find(".select2-result:first-child").click
+
+ click_button "Add a menu node"
+ end
+
+ it "lets a user add a menu node" do
+ open_page_properties
+ add_menu_item
+
+ within "#connected_nodes" do
+ expect(page).to have_content("Menu node Menu / A Page 1")
+ end
+ within "[panel='nodes']" do
+ expect(page).to have_content("(1) Menu node")
+ end
+ end
+
+ context "without parent id" do
+ it "displays error message" do
+ open_page_properties
+
+ click_button "Add a menu node"
+ within ".flash.error" do
+ expect(page).to have_content("Menu Type can't be blank")
+ end
+ end
+ end
+
+ context "with menu node present" do
+ before do
+ open_page_properties
+ add_menu_item
+ end
+
+ it "lets a user remove a menu node" do
+ page.accept_alert "Do you really want to delete this menu node?" do
+ click_link_with_tooltip("Delete this menu node")
+ end
+
+ within "#connected_nodes" do
+ expect(page).to_not have_content("Menu node Menu / A Page 1")
+ expect(page).to have_content(Alchemy.t("No menu node for this page found"))
+ end
+ within "[panel='nodes']" do
+ expect(page).to have_content("(0) Menu nodes")
+ end
+ end
+ end
+end
diff --git a/spec/features/admin/page_editing_feature_spec.rb b/spec/features/admin/page_editing_feature_spec.rb
index 1a5df80b8b..0d72de45e7 100644
--- a/spec/features/admin/page_editing_feature_spec.rb
+++ b/spec/features/admin/page_editing_feature_spec.rb
@@ -226,7 +226,7 @@
it "saves the name" do
within(".alchemy-dialog.modal") do
find("input#page_name").set("name with some %!x^)'([@!{}]|/?:# characters")
- find(".submit button").click
+ find(".edit_page .submit button").click
end
expect(page).to_not have_selector(".alchemy-dialog-overlay.open")
expect(page).to have_selector("#sitemap a.sitemap_pagename_link", text: "name with some %!x^)'([@!{}]|/?:# characters")
@@ -240,7 +240,7 @@
within(".alchemy-dialog.modal") do
expect(page).to have_css("#s2id_page_parent_id")
select2_search(new_parent.name, from: "Parent")
- find(".submit button").click
+ find(".edit_page .submit button").click
end
expect(page).to_not have_selector(".alchemy-dialog-overlay.open")
expect(page).to have_selector("#sitemap .sitemap_url", text: "/#{new_parent.urlname}/#{a_page.urlname}")