summaryrefslogtreecommitdiffhomepage
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/nodes/edit.html.erb21
-rw-r--r--app/views/nodes/index.html.erb27
-rw-r--r--app/views/nodes/show.html.erb3
3 files changed, 41 insertions, 10 deletions
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb
new file mode 100644
index 0000000..0b64046
--- /dev/null
+++ b/app/views/nodes/edit.html.erb
@@ -0,0 +1,21 @@
+<h1>edit wiki page</h1>
+<%= form_with(model: @node, local: true) do |form| %>
+ <p>
+ <%= form.label :title %><br>
+ <%= form.text_field :title %>
+ </p>
+
+ <p>
+ <%= form.label :content %><br>
+ <%= form.text_area :content %>
+ </p>
+
+ <%= form.collection_select :parent, @nodes, :id, :title, include_blank: true, :selected => @node&.parent&.id %>
+
+
+ <p>
+ <%= form.submit %>
+ </p>
+<% end %>
+
+<% link_to 'Back', nodes_path %>
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb
index 2a14880..d787727 100644
--- a/app/views/nodes/index.html.erb
+++ b/app/views/nodes/index.html.erb
@@ -1,15 +1,22 @@
<h1> suh </h1>
+<p>
<% @rootnodes.each do |rootnode| %>
- <tr>
- <td>PARENT: <%= rootnode.title %></td>
- </tr><br>
- <em>
- <% rootnode.children.each do |node| %>
- <tr>
- <td>CHILD: <%= node[:title] %></td>
- </tr><br>
- <% end %>
- </em>
+ <% if rootnode.children.any? %>
+ <details class="indent">
+ <summary><%= rootnode.title %></summary>
+ <% rootnode.children.each do |node| %>
+ <%= showNestedChildren(node, 1) %>
+ <% end %>
+ </details>
+ <% else %>
+ <div class="indent"><%= rootnode.title %></div>
+ <% end %>
<% end %>
+</p>
+
+<details>
+ <summary>See More</summary>
+ This text will be hidden if your browser supports it.
+</details>
diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb
index c933d1e..ccca323 100644
--- a/app/views/nodes/show.html.erb
+++ b/app/views/nodes/show.html.erb
@@ -6,4 +6,7 @@
<p>
<strong>Content:</strong>
<%= @node.content %>
+<% @node.children.each do |child| %>
+ <%= child.id %>
+<% end %>
</p>