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..a23c5a557f --- /dev/null +++ b/app/views/alchemy/admin/nodes/_page_nodes.erb @@ -0,0 +1,56 @@ +<%= turbo_frame_tag("page_nodes") do %> +
+ <%= Alchemy::Node.model_name.human %> + | ++ |
---|---|
<%= node.name %> <%= node.url %> | +
+ |
+
<%= Alchemy.t('No menu node for this page found') %> | ++ |