我正在使用 best_in_place gem,所以我可以在我的索引视图中编辑多个学生。
但问题是可用性很差。我必须单击,输入信息,输入/单击并再次单击以编辑其他信息。
这是我可以按 Tab 键通过字段的一种方式吗?
这是索引的代码:
<% @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 %>
我发现了这个:https ://github.com/bernat/best_in_place/tree/master/lib/best_in_place
行。这就是我现在得到的,但仍然无法正常工作:/有什么想法吗?
指数:
<td><%= best_in_place allan, :oral, :html_attrs => {:tabindex => 10} %></td>
<td><%= best_in_place allan, :writing, :html_attrs => {:tabindex => 11} %></td>
用户.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'))