hyperlink - Rails 4 link_to option to include data -
i have link follows
<a title="" class="btn btn-default btn-icon btn-xs tip" href="#" data-original-title="edit"><i class="fa fa-pencil"></i></a> what have tried?
<%= link_to "<i class="fa fa-pencil"></i>".html_safe, edit_admin_category_path(category), :class => 'btn btn-default btn-icon btn-xs tip', :data => {:original-title=>"edit"} %> error:
/users/harshamv/sites/nomad/app/views/admin/categories/index.html.erb:28: syntax error, unexpected tidentifier, expecting ')' is there way utilize link_to without have utilize next format
<%= link_to(@profile) %> <strong><%= @profile.name %></strong> -- <span>check out!</span> <% end %>
your approach work, it's syntax error need prepare double quotes.
<%= link_to "<i class='fa fa-pencil'></i>".html_safe, edit_admin_category_path(category), :class => 'btn btn-default btn-icon btn-xs tip', :data => {:original-title=>"edit"} %> you utilize content_tag little cleaner
<%= link_to content_tag(:li, '', class: 'fa fa-pencil'), edit_admin_category_path(category), :class => 'btn btn-default btn-icon btn-xs tip', :data => {:original-title=>"edit"} %> ruby-on-rails hyperlink
No comments:
Post a Comment