0
我有一個觀點,有很多重複的邏輯。我不太清楚如何烘乾它。如何幹這個視圖?
任何想法?
<li><a href="#">Great Grandparents</a>
<ul>
<li><% if relative.humanize == "Great grandfather" || relative.humanize == "Great grandmother" %>
<%= link_to image_tag(membership.user.avatar.url, size: "48x48", :class => "img-circle") , family_tree_path(membership.user.family_tree) %>
<%= link_to membership.user.name, family_tree_path(membership.user.family_tree)%>
<% else %>
None added yet, add them <%= link_to 'here', "#" , class: 'btn invite popupbox','data-popup' => 'invite_friend' %>
<% end %>
</li>
</ul>
</li>
<li><a href="#">Grandparents</a>
<ul>
<li><% if relative.humanize == "Grandfather" || relative.humanize == "Grandmother" %>
<%= link_to image_tag(membership.user.avatar.url, size: "48x48", :class => "img-circle") , family_tree_path(membership.user.family_tree) %>
<%= link_to membership.user.name, family_tree_path(membership.user.family_tree)%>
<% else %>
None added yet, add them <%= link_to 'here', "#" , class: 'btn invite popupbox','data-popup' => 'invite_friend' %>
<% end %>
</li>
</ul>
</li>
<li><a href="#">Parents</a>
<ul>
<li><% if relative.humanize == "Mom" || relative.humanize == "Dad" %>
<%= link_to image_tag(membership.user.avatar.url, size: "48x48", :class => "img-circle") , family_tree_path(membership.user.family_tree) %>
<%= link_to membership.user.name, family_tree_path(membership.user.family_tree)%>
<% else %>
None added yet, add them <%= link_to 'here', "#" , class: 'btn invite popupbox','data-popup' => 'invite_friend' %>
<% end %>
</li>
</ul>
</li>
注:上面已被截斷,有至少7個以上。有很多重複,但我不太確定如何以Railsy的方式幹掉它。
會員資格和親戚如何相互關聯? – Surya 2014-10-09 04:18:25