Files
grecia/app/views/follows/_followable_button.html.erb

43 lines
1.6 KiB
Plaintext

<span class="js-follow">
<span class="followable-content">
<% if show_follow_action? followable %>
<%= link_to "##{follow_link_wrapper_id(followable)}",
id: follow_link_wrapper_id(followable),
title: follow_entity_text(followable),
data: { toggle: follow_drop_id(followable) } do %>
<%= t('shared.follow') %>
<% end %>
<div class="dropdown-pane" id="<%= follow_drop_id(followable) %>"
data-dropdown data-auto-focus="true">
<%= link_to follow_entity_text(followable),
follows_path(followable_id: followable.id,
followable_type: followable.class.name),
method: :post, remote: true,
id: follow_link_id(followable) %>
</div>
<% end %>
<% if show_unfollow_action? followable %>
<% follow = followable.follows.where(user: current_user).first %>
<%= link_to "##{unfollow_link_wrapper_id(followable)}",
id: unfollow_link_wrapper_id(followable),
title: unfollow_entity_text(followable),
data: { toggle: unfollow_drop_id(followable) } do %>
<%= t('shared.unfollow') %>
<% end %>
<div class="dropdown-pane" id="<%= unfollow_drop_id(followable) %>"
data-dropdown data-auto-focus="true">
<%= link_to unfollow_entity_text(followable),
follow_path(follow),
method: :delete, remote: true,
id: unfollow_link_id(followable) %>
</div>
<% end %>
</span>
</span>