I’m using best_in_place gem so I can edit multiple students in my index view.
The problem though, is that the usuability is bad.
I have to click, type the info, enter/click and click again to edit another information.
Is that a way that I can press Tab to go trough the fields?
Here is the code of the Index:
<% @students.each do |student| %>
<tr>
<td><%= link_to .name, edit_student_path(student) %></td>
<td><%= best_in_place student, :oral %></td>
<td><%= best_in_place student, :writing %></td>
<td><%= best_in_place student, :participation %></td>
<td><%= best_in_place student, :grammar %></td>
<td><%= best_in_place student, :presence, type: :select, collection: [["Present", "Present"], ["Absent", "Absent"], ["", "-"]] %></td>
</tr>
<% end %>
I found this: https://github.com/bernat/best_in_place/tree/master/lib/best_in_place
Ok.
This is what I get now, But still’s not working :/
Any Ideas?
index:
<td><%= best_in_place allan, :oral, :html_attrs => {:tabindex => 10} %></td>
<td><%= best_in_place allan, :writing, :html_attrs => {:tabindex => 11} %></td>
Users.js.coffee
jQuery ->
$('.best_in_place').best_in_place()
$ ->
$('span.best_in_place').focus ->
el = $(this)
el.click()
el.find(el.data('type')).attr('tabindex', el.attr('tabindex'))
I think you can hack around a little bit using
tabindexHTML attribute andfocusevent like this:and this JS
That last line of the JS code is searching for the element type of BIP form and assigns the
tabindexso the order of tabbing is maintained.UPDATE: The CoffeeScript version of the above JS