Skip to content
Browse files

Rewrote index views to simplify markup

  • Loading branch information...
1 parent 4a5ca1c commit eb55f36a6c202ba02a2db908a4b548f3eee2be5e @jcasimir jcasimir committed
Showing with 26 additions and 34 deletions.
  1. +13 −16 app/views/companies/index.html.erb
  2. +13 −18 app/views/people/index.html.erb
View
29 app/views/companies/index.html.erb
@@ -1,21 +1,18 @@
<% title "Companies" %>
-<table>
- <tr>
- <th>Name</th>
- <th>Email Addresses</th>
- <th>Phone Numbers</th>
- </tr>
- <% for company in @companies %>
- <tr>
- <td><%= company.name %></td>
- <td><%= render :partial => 'email_addresses/email_addresses', :object => company.email_addresses %>
- <td><%= render :partial => 'phone_numbers/phone_numbers', :object => company.phone_numbers %>
- <td><%= link_to "Show", company %></td>
- <td><%= link_to "Edit", edit_company_path(company) %></td>
- <td><%= link_to "Destroy", company, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
+<div class="companies">
+ <% @companies.each do |company| %>
+ <div class="company">
+ <h4><%= company.name %></h4>
+ <%= render :partial => 'email_addresses/email_addresses', :object => company.email_addresses %>
+ <%= render :partial => 'phone_numbers/phone_numbers', :object => company.phone_numbers %>
+ <ul class="actions">
+ <%= link_to "Show", company %>
+ <%= link_to "Edit", edit_company_path(company) %>
+ <%= link_to "Destroy", company, :confirm => 'Are you sure?', :method => :delete %>
+ </ul>
+ </div>
<% end %>
-</table>
+</div>
<p><%= link_to "New Company", new_company_path %></p>
View
31 app/views/people/index.html.erb
@@ -1,23 +1,18 @@
<% title "People" %>
-<table>
- <tr>
- <th>First Name</th>
- <th>Last Name</th>
- <th>Phone Numbers</th>
- <th>Email Addresses</th>
- </tr>
- <% for person in @people %>
- <tr>
- <td><%= person.first_name %></td>
- <td><%= person.last_name %></td>
- <td><%= render :partial => 'phone_numbers/phone_numbers', :object => person.phone_numbers %></td>
- <td><%= render :partial => 'email_addresses/email_addresses', :object => person.email_addresses %>
- <td><%= link_to "Show", person %></td>
- <td><%= link_to "Edit", edit_person_path(person) %></td>
- <td><%= link_to "Destroy", person, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
+<div class="people">
+ <% @people.each do |person| %>
+ <div class="company">
+ <h4><%= person.last_name %>, <%= person.first_name %></h4>
+ <%= render :partial => 'phone_numbers/phone_numbers', :object => person.phone_numbers %>
+ <%= render :partial => 'email_addresses/email_addresses', :object => person.email_addresses %>
+ <ul class="actions">
+ <li><%= link_to "Show", person %></li>
+ <li><%= link_to "Edit", edit_person_path(person) %></li>
+ <li><%= link_to "Destroy", person, :confirm => 'Are you sure?', :method => :delete %></li>
+ </ul>
+ </div>
<% end %>
</table>
-<p><%= link_to "New Person", new_person_path %></p>
+<p><%= link_to "New Person", new_person_path, :id => "new_person" %></p>

0 comments on commit eb55f36

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