-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new menu tab to page configuration dialog. This is a shortcut to create a menu entry for the current page. It is also the first try to provide Turbo Frames inside of Alchemy, which is coming with a few challenges (flash messages, and updated tab headline)
- Loading branch information
1 parent
1d81e7f
commit 535ab2d
Showing
9 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<%= turbo_frame_tag("page_nodes") do %> | ||
<table class="list" id="connected_nodes"> | ||
<tr> | ||
<th class="name"> | ||
<%= Alchemy::Node.model_name.human %> | ||
</th> | ||
<th class="tools"></th> | ||
</tr> | ||
<% if @page.nodes.length > 0 %> | ||
<% @page.nodes.each do |node| %> | ||
<tr class="even"> | ||
<td><%= node.name %> <%= node.url %></td> | ||
<td class="tools"> | ||
<sl-tooltip content="<%= Alchemy.t("delete_node") %>"> | ||
<%= link_to render_icon(:minus), | ||
admin_node_path(node), | ||
class: "icon_button", | ||
data: { turbo_method: :delete, turbo_confirm: Alchemy.t('confirm_to_delete_node') } %> | ||
</sl-tooltip> | ||
</td> | ||
</tr> | ||
<% end %> | ||
<% else %> | ||
<tr class="even"> | ||
<td><%= Alchemy.t('No menu node for this page found') %></td> | ||
<td class="tools"></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<fieldset> | ||
|
||
<legend><%= Alchemy.t('Create node on parent:') %></legend> | ||
<%= alchemy_form_for([:admin, @node_url ||= @page.nodes.build], id: "new_node_form") do |f| %> | ||
<%= f.hidden_field :page_id, value: @page.id %> | ||
<%= f.hidden_field :language_id, value: @page.language_id %> | ||
|
||
<%= render Alchemy::Admin::NodeSelect.new(nil, url: alchemy.api_nodes_path(language_id: @page.language_id, include: :ancestors)) do %> | ||
<%= f.text_field :parent_id, class: 'alchemy_selectbox full_width' %> | ||
<% end %> | ||
|
||
<div class="submit"> | ||
<button class="with_icon"> | ||
<%= render_icon(:plus) %> | ||
<%= Alchemy.t(:create_node) %> | ||
</button> | ||
</div> | ||
<% end %> | ||
</fieldset> | ||
<alchemy-growl message="<%= flash[:notice] %>"></alchemy-growl> | ||
<% end %> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= render "page_nodes" %> | ||
<script type="text/javascript" charset="utf-8"> | ||
Alchemy.growl() | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= render "page_nodes" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters