Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#17] Move markup for friend into partial

  • Loading branch information...
commit 285c93c3769b20af45b046f9637b966375bd730a 1 parent dad72b5
@harlow harlow authored
View
16 app/views/friends/_friend.html.erb
@@ -0,0 +1,16 @@
+<div class="friend" id="<%= friend.id %>">
+ <div class="front">
+ <%= link_to friend, class: 'pic-link' do %>
+ <%= image_tag friend.avatar.url(:square) %>
+ <% end %>
+ </div>
+
+ <div class="back">
+ <span class="friend-name"><%= friend.name %></span>
+ <div class="actions">
+ <%= link_to 'Show', friend %>
+ <%= link_to 'Edit', edit_friend_path(friend) %>
+ <%= link_to 'Delete', friend, confirm: 'Are you sure you want to lose a friend?', method: :delete, class: 'destroy' %>
+ </div>
+ </div>
+</div>
View
18 app/views/friends/index.html.erb
@@ -1,21 +1,5 @@
<h2>Make a new friend <%= link_to 'New Friend', new_friend_path, class: 'new-friend' %></h2>
<section id="friends">
- <% @friends.each do |friend| %>
- <div class="friend" id="<%= friend.id %>">
- <div class="front">
- <%= link_to friend, class: 'pic-link' do %>
- <%= image_tag friend.avatar.url(:square) %>
- <% end %>
- </div>
- <div class="back">
- <span class="friend-name"><%= friend.name %></span>
- <div class="actions">
- <%= link_to 'Show', friend %>
- <%= link_to 'Edit', edit_friend_path(friend) %>
- <%= link_to 'Delete', friend, confirm: 'Are you sure you want to lose a friend?', method: :delete, class: 'destroy' %>
- </div>
- </div>
- </div>
- <% end %>
+ <%= render @friends %>
</section>
Please sign in to comment.
Something went wrong with that request. Please try again.