parent/child CRUD complete
This commit is contained in:
24
app/views/parents/edit.html.haml
Normal file
24
app/views/parents/edit.html.haml
Normal file
@ -0,0 +1,24 @@
|
||||
%h2 Edit #{@parent.name}
|
||||
|
||||
%p= link_to 'back', parent_path(@parent)
|
||||
|
||||
- if @parent.errors.full_messages.any?
|
||||
.errors
|
||||
%h1 Uh oh!
|
||||
- @parent.errors.full_messages.each do |e|
|
||||
%p= e
|
||||
|
||||
= form_for @parent, as: :parent, url: update_parent_path do |f|
|
||||
= f.label :first_name
|
||||
= f.text_field :first_name
|
||||
|
||||
= f.label :last_name
|
||||
= f.text_field :last_name
|
||||
|
||||
= f.label :phone
|
||||
= f.phone_field :phone
|
||||
|
||||
= f.label :email
|
||||
= f.email_field :email
|
||||
|
||||
= f.submit
|
@ -2,12 +2,12 @@
|
||||
|
||||
- @parents.each do |parent|
|
||||
%ul
|
||||
%li= link_to parent.name, parent_path(parent)
|
||||
%li
|
||||
= link_to parent.name, parent_path(parent)
|
||||
= number_to_phone parent.phone
|
||||
= page_link(parent)
|
||||
%li= number_to_phone parent.phone
|
||||
%li= mail_to parent.email
|
||||
%li= mail_to parent.email, nil, encode: 'hex'
|
||||
%li Children:
|
||||
%ul
|
||||
- parent.children.each do |child|
|
||||
%li= child.name
|
||||
%li= link_to child.name, child_path(child)
|
||||
|
@ -8,7 +8,7 @@
|
||||
%ul
|
||||
- @parent.children.each do |child|
|
||||
%li
|
||||
= child.name
|
||||
= link_to child.name, child_path(child)
|
||||
= link_to 'remove', del_parenthood_path(@parent, child), method: :delete
|
||||
|
||||
%p Add Child:
|
||||
|
Reference in New Issue
Block a user