私は best_in_place gem を使用しているので、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 %>
私はこれを見つけました: https://github.com/bernat/best_in_place/tree/master/lib/best_in_place
Ok。これは私が今得たものですが、まだ機能していません:/何かアイデアはありますか?
索引:
<td><%= best_in_place allan, :oral, :html_attrs => {:tabindex => 10} %></td>
<td><%= best_in_place allan, :writing, :html_attrs => {:tabindex => 11} %></td>
ユーザー.js.コーヒー
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'))