Jan Barret
Jan Barret

Reputation: 35

How to rewrite deleting link_to helper to use it with glyphicon icon?

I want my unattractive Delete link to become a glyphicon icon. How can I rewrite the following code?

   <%= link_to 'Delete', user_task_path(current_user, task.id),
        data: { confirm: 'Are you sure?' }, :method => :delete, remote: true %>

Upvotes: 0

Views: 1002

Answers (1)

Athar
Athar

Reputation: 3268

try this

    <%= link_to user_task_path(current_user, task.id), method: :delete, data: { confirm: 'Are you sure?' }, remote: true do %>
      <i class="glyphicon glyphicon-trash"></i>
    <% end %>

Upvotes: 3

Related Questions