diff options
Diffstat (limited to 'app/views/nodes/show.html.erb')
| -rw-r--r-- | app/views/nodes/show.html.erb | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb index 189adb89..963bc37c 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb | |||
| @@ -101,17 +101,30 @@ | |||
| 101 | <%= link_to 'add event', new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path) %> | 101 | <%= link_to 'add event', new_event_path(node_id: @node.id, tag_list: mapping&.last, auto_tag_source: mapping&.first, return_to: request.path) %> |
| 102 | </div> | 102 | </div> |
| 103 | 103 | ||
| 104 | <% if @node.children.any? %> | 104 | <% matches = matching_node_kinds(@node) %> |
| 105 | <% if @node.children.any? || matches.any? %> | ||
| 105 | <div class="node_description">Children</div> | 106 | <div class="node_description">Children</div> |
| 106 | <div class="node_content node_info_group"> | 107 | <div class="node_content node_info_group"> |
| 107 | <details> | 108 | <% if @node.children.any? %> |
| 108 | <summary><%= pluralize(@node.children.count, 'child', 'children') %></summary> | 109 | <details> |
| 109 | <ul> | 110 | <summary><%= pluralize(@node.children.count, 'child', 'children') %></summary> |
| 110 | <% @node.children.order(:slug).each do |child| %> | 111 | <ul> |
| 111 | <li><%= link_to (child.head&.title || child.draft&.title || child.slug), node_path(child) %></li> | 112 | <% @node.children.order(:slug).each do |child| %> |
| 113 | <li><%= link_to (child.head&.title || child.draft&.title || child.slug), node_path(child) %></li> | ||
| 114 | <% end %> | ||
| 115 | </ul> | ||
| 116 | </details> | ||
| 117 | <% end %> | ||
| 118 | <% if matches.any? %> | ||
| 119 | <p class="add_child_links"> | ||
| 120 | <% matches.each_with_index do |(kind, config), index| %> | ||
| 121 | <%= " · ".html_safe if index > 0 %> | ||
| 122 | <% link_params = { kind: kind } %> | ||
| 123 | <% link_params[:parent_id] = @node.id if kind == "generic" %> | ||
| 124 | <%= link_to "add '#{resolve_kind_text(config[:label])}' child", new_node_path(link_params) %> | ||
| 112 | <% end %> | 125 | <% end %> |
| 113 | </ul> | 126 | </p> |
| 114 | </details> | 127 | <% end %> |
| 115 | </div> | 128 | </div> |
| 116 | <% end %> | 129 | <% end %> |
| 117 | 130 | ||
