AyuntamientoMadrid/participacion

View on GitHub
app/views/follows/_follow_button.html.erb

Summary

Maintainability
Test Coverage
<div class="js-follow">
  <span class="followable-content">
    <% if follow.followable.followed_by?(current_user) %>
      <%= link_to t("shared.following"),
                  follow_path(follow),
                  method: :delete, remote: true,
                  title: unfollow_text(follow.followable),
                  class: "button expanded" %>

    <% else %>
      <%= link_to follow_text(follow.followable),
                  follows_path(followable_id: follow.followable.id,
                               followable_type: follow.followable.class.name),
                  method: :post, remote: true,
                  title: follow_text(follow.followable),
                  class: "button hollow expanded" %>
    <% end %>
  </span>
</div>