diff --git a/app/assets/stylesheets/alchemy/forms.scss b/app/assets/stylesheets/alchemy/forms.scss
index 219529a5f0..ae294f1661 100644
--- a/app/assets/stylesheets/alchemy/forms.scss
+++ b/app/assets/stylesheets/alchemy/forms.scss
@@ -169,7 +169,8 @@ form {
}
.inline-input {
- @include clearfix;
+ align-items: center;
+ display: flex;
margin: 0 -1 * $default-margin;
.left-column,
@@ -179,12 +180,10 @@ form {
.left-column {
width: $form-right-width;
- float: left;
}
.right-column {
width: $form-left-width;
- float: right;
}
button,
diff --git a/app/controllers/alchemy/admin/nodes_controller.rb b/app/controllers/alchemy/admin/nodes_controller.rb
index 9695f26048..3bfe2f663b 100644
--- a/app/controllers/alchemy/admin/nodes_controller.rb
+++ b/app/controllers/alchemy/admin/nodes_controller.rb
@@ -16,6 +16,29 @@ def new
)
end
+ def create
+ if turbo_frame_request?
+ @node = Alchemy::Node.build(resource_params)
+ @page = @node.page
+ @node.save
+ flash_notice_for_resource_action(:create)
+ else
+ super
+ end
+ end
+
+ def destroy
+ if turbo_frame_request?
+ @node = Alchemy::Node.find(params[:id])
+ @page = @node.page
+ @node.destroy
+ @page.reload # reload the page to update the nodes collection
+ flash_notice_for_resource_action(:destroy)
+ else
+ super
+ end
+ end
+
private
def resource_params
diff --git a/app/javascript/alchemy_admin.js b/app/javascript/alchemy_admin.js
index 8c2b755834..268ca46c3b 100644
--- a/app/javascript/alchemy_admin.js
+++ b/app/javascript/alchemy_admin.js
@@ -25,6 +25,7 @@ import "alchemy_admin/components/clipboard_button"
import "alchemy_admin/components/datepicker"
import "alchemy_admin/components/dialog_link"
import "alchemy_admin/components/element_editor"
+import "alchemy_admin/components/growl"
import "alchemy_admin/components/ingredient_group"
import "alchemy_admin/components/link_buttons"
import "alchemy_admin/components/node_select"
diff --git a/app/javascript/alchemy_admin/components/growl.js b/app/javascript/alchemy_admin/components/growl.js
new file mode 100644
index 0000000000..f84b3d4b4a
--- /dev/null
+++ b/app/javascript/alchemy_admin/components/growl.js
@@ -0,0 +1,13 @@
+export class Growl extends HTMLElement {
+ connectedCallback() {
+ if (this.message) {
+ Alchemy.growl(this.message)
+ }
+ }
+
+ get message() {
+ return this.getAttribute("message")
+ }
+}
+
+customElements.define("alchemy-growl", Growl)
diff --git a/app/views/alchemy/admin/nodes/_page_nodes.erb b/app/views/alchemy/admin/nodes/_page_nodes.erb
new file mode 100644
index 0000000000..41350a7cf1
--- /dev/null
+++ b/app/views/alchemy/admin/nodes/_page_nodes.erb
@@ -0,0 +1,53 @@
+<%= turbo_frame_tag("page_nodes") do %>
+
+
+
+ <%= Alchemy::Node.model_name.human %>
+ |
+ |
+
+ <% if @page.nodes.length > 0 %>
+ <% @page.nodes.each do |node| %>
+
+ <%= node.name %> <%= node.url %> |
+
+ ">
+ <%= link_to render_icon(:minus),
+ admin_node_path(node),
+ class: "icon_button",
+ data: { turbo_method: :delete, turbo_confirm: Alchemy.t('confirm_to_delete_node') } %>
+
+ |
+
+ <% end %>
+ <% else %>
+
+ <%= 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..182cf1fda7
--- /dev/null
+++ b/app/views/alchemy/admin/nodes/create.html.erb
@@ -0,0 +1,4 @@
+<%= 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..b04b15319d 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') %>
+
+ (<%= @page.nodes.size %>) <%= Alchemy::Node.model_name.human(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..4b2fcebf18 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"