Remove complex methods from follow model. Create instance method followed_by? on followable model concern. Some code improvements.
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
<span class="js-follow">
|
||||
<span class="followable-content">
|
||||
|
||||
<% unless followed?(current_user, follow.followable) %>
|
||||
<% if follow.followable.followed_by?(current_user) %>
|
||||
|
||||
<%= link_to t('shared.unfollow'),
|
||||
follow_path(follow),
|
||||
method: :delete, remote: true,
|
||||
title: unfollow_text(follow.followable),
|
||||
class: 'button hollow' %>
|
||||
|
||||
<% else %>
|
||||
|
||||
<%= link_to t('shared.follow'),
|
||||
follows_path(followable_id: follow.followable.id,
|
||||
@@ -10,14 +18,6 @@
|
||||
title: follow_text(follow.followable),
|
||||
class: 'button hollow' %>
|
||||
|
||||
<% else %>
|
||||
|
||||
<%= link_to t('shared.unfollow'),
|
||||
follow_path(follow),
|
||||
method: :delete, remote: true,
|
||||
title: unfollow_text(follow.followable),
|
||||
class: 'button hollow' %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user