Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Cleanup to match tutorial

  • Loading branch information...
commit 5b007f17e004d62f58290012e28dd868e46aeb69 1 parent 62b6bd5
Jeff Casimir authored
4 app/views/companies/edit.html.erb
... ... @@ -1,8 +1,8 @@
1 1 <% title "Edit #{@company.name}" %>
2 2
3   -<%= render 'form' %>
4   -
5 3 <ul class="actions">
6 4 <li><%= link_to "Show", @company %></li>
7 5 <li><%= link_to "View All", companies_path %></li>
8 6 </ul>
  7 +
  8 +<%= render 'form' %>
12 app/views/companies/index.html.erb
... ... @@ -1,12 +0,0 @@
1   -<% title "Companies" %>
2   -
3   -<p><%= link_to "New Company", new_company_path %></p>
4   -<div class="companies">
5   - <% @companies.each do |company| %>
6   - <div class="company">
7   - <h4><%= link_to company.name, company %></h4>
8   - <%= render :partial => "phone_numbers/list", :object => company.phone_numbers %>
9   - <%= render :partial => "email_addresses/list", :object => company.email_addresses %>
10   - </div>
11   - <% end %>
12   -</div>
8 app/views/companies/index.html.haml
... ... @@ -1,14 +1,14 @@
1 1 - title "Companies"
2 2
  3 +%p= link_to "New Company", new_company_path, :id => "new_company"
  4 +
3 5 .companies
4 6 - @companies.each do |company|
5 7 .company
6   - %h4= company.name
  8 + %h4= link_to company, company
7 9 = render :partial => 'email_addresses/email_addresses', :object => company.email_addresses
8 10 = render :partial => 'phone_numbers/phone_numbers', :object => company.phone_numbers
9 11 %ul.actions
10 12 = link_to "Show", company
11 13 = link_to "Edit", edit_company_path(company)
12   - = link_to "Destroy", company, :confirm => 'Are you sure?', :method => :delete
13   -
14   -%p= link_to "New Company", new_company_path
  14 + = link_to "Destroy", company, :confirm => 'Are you sure?', :method => :delete
18 app/views/people/index.html.erb
... ... @@ -1,18 +0,0 @@
1   -<% title "People" %>
2   -
3   -<p><%= link_to "New Person", new_person_path, :id => "new_person" %></p>
4   -
5   -<div class="people">
6   - <% @people.each do |person| %>
7   - <div class="person">
8   - <h4><%= person.last_name %>, <%= person.first_name %></h4>
9   - <%= render :partial => 'phone_numbers/phone_numbers', :object => person.phone_numbers %>
10   - <%= render :partial => 'email_addresses/email_addresses', :object => person.email_addresses %>
11   - <ul>
12   - <li><%= link_to "Show", person %></li>
13   - <li><%= link_to "Edit", edit_person_path(person) %></li>
14   - <li><%= link_to "Destroy", person, :confirm => 'Are you sure?', :method => :delete %></li>
15   - </ul>
16   - </div>
17   - <% end %>
18   -</div>
14 app/views/people/index.html.haml
... ... @@ -0,0 +1,14 @@
  1 +- title "People"
  2 +
  3 +%p= link_to "New Person", new_person_path, :id => "new_person"
  4 +
  5 +.people
  6 + - @people.each do |person|
  7 + .person
  8 + %h4= link_to person, person
  9 + = render :partial => 'email_addresses/email_addresses', :object => person.email_addresses
  10 + = render :partial => 'phone_numbers/phone_numbers', :object => person.phone_numbers
  11 + %ul.actions
  12 + = link_to "Show", person
  13 + = link_to "Edit", edit_person_path(person)
  14 + = link_to "Destroy", person, :confirm => 'Are you sure?', :method => :delete
6 app/views/people/show.html.erb
... ... @@ -1,14 +1,14 @@
1 1 <div class="person">
2   - <% title "#{@person.last_name}, #{@person.first_name}" %>
3   -
4 2 <ul class="actions">
5 3 <li><%= link_to "Edit", edit_person_path(@person) %></li>
6 4 <li><%= link_to "Destroy", @person, :confirm => 'Are you sure?', :method => :delete %></li>
7 5 <li><%= link_to "View All", people_path %></li>
8 6 </ul>
9 7
  8 + <% title "#{@person.last_name}, #{@person.first_name}" %>
  9 +
10 10 <%= render :partial => 'phone_numbers/phone_numbers', :object => @person.phone_numbers %>
11   - <%= link_to "Add a New Phone Number", new_phone_number_path(:person_id => @person.id ) %>
  11 + <%= link_to "Add a New Phone Number", new_phone_number_path(:person_id => @person.id ), :id => "new_phone_number" %>
12 12
13 13 <%= render :partial => 'email_addresses/email_addresses', :object => @person.email_addresses %>
14 14 <%= link_to "Add a New Email Address", new_email_address_path(:person_id => @person.id ), :id => "new_email_address" %>
9 app/views/phone_numbers/_list.html.erb
... ... @@ -1,9 +0,0 @@
1   -<ul class='phone_numbers'>
2   - <% list.each do |phone_number| %>
3   - <li>
4   - <%= phone_number.number%>
5   - <%= link_to "edit", edit_phone_number_path(phone_number) %>
6   - <%= link_to "delete", phone_number_path(phone_number), :method => :delete, :id => "delete_phone_number_#{phone_number.id}" %>
7   - </li>
8   - <% end %>
9   -</ul>

0 comments on commit 5b007f1

Please sign in to comment.
Something went wrong with that request. Please try again.