noesya/osuny

View on GitHub
app/views/admin/application/favorites/_widget.html.erb

Summary

Maintainability
Test Coverage
<span>
  <% if current_user.favorite?(about)%>
    <%= link_to admin_favorite_path(
                  operation: :remove, 
                  about_id: about.id, 
                  about_type: about.class.polymorphic_name
                ), 
                method: :put,
                title: t('user.favorites.remove') do %>
      <i class="fas fa-star"></i>
    <% end %>
  <% else %>
    <%= link_to admin_favorite_path(
                  operation: :add, 
                  about_id: about.id, 
                  about_type: about.class.polymorphic_name
                ), 
                method: :put,
                title: t('user.favorites.add') do %>
      <i class="fa-regular fa-star"></i>
    <% end %>
  <% end %>
</span>