Activate Rails link_to ajax , call with jquery -


i have rails view these remote link_to's

<%= link_to 'next', next_page_path, remote:true %> <%= link_to 'previous', previous_page_path, remote:true%> 

i want make possible activate these left , right arrow buttons on keyboard?. there way without using jquery "click" function?

edit: misread question, can bind link_to specific key so:

<%= link_to 'previous', previous_page_path, :html_options => {:accesskey => "left arrow"} %> 

old answer (icons):

what type of icons wanting use? can make use of .html_safe helper method. here's example fontawesome icon:

<%= link_to '<i class="fa fa-heart-o"></i>'.html_safe,     {controller: "users", action: "save_user", user: @user} %> 

and 1 without using helper, using example:

<%= link_to next_page_path %>     <i class="fa fa-arrow"></i> <% end %> 

in way if click icon, redirected appropriate view or controller/action.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -