diff options
Diffstat (limited to 'app/views/nodes')
| -rw-r--r-- | app/views/nodes/index.html.erb | 15 | ||||
| -rw-r--r-- | app/views/nodes/new.html.erb | 18 | ||||
| -rw-r--r-- | app/views/nodes/show.html.erb | 9 |
3 files changed, 42 insertions, 0 deletions
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb new file mode 100644 index 0000000..2a14880 --- /dev/null +++ b/app/views/nodes/index.html.erb @@ -0,0 +1,15 @@ +<h1> suh </h1> + +<% @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> +<% end %> + diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb new file mode 100644 index 0000000..ee0adb6 --- /dev/null +++ b/app/views/nodes/new.html.erb @@ -0,0 +1,18 @@ +<h1>new wiki page</h1> +<%= form_with scope: :node, url: nodes_path, 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 %> + + <p> + <%= form.submit %> + </p> +<% end %> diff --git a/app/views/nodes/show.html.erb b/app/views/nodes/show.html.erb new file mode 100644 index 0000000..c933d1e --- /dev/null +++ b/app/views/nodes/show.html.erb @@ -0,0 +1,9 @@ +<p> +<strong>Title:</strong> +<%= @node.title %> +</p> + +<p> +<strong>Content:</strong> +<%= @node.content %> +</p> |
