Edit Rails records in-place like a spreadsheet
Ever want something like this for your app? Then read on.
First, put this into your Gemfile: gem "bestinplace"</code>
And: $ bundle</code>. Then, fire up your text editor, open assets/javascript/active_admin.js</code> and fill it with these lines:
+//= require jquery
+//= require jquery-ui
+//= require jquery.purr
+//= require best_in_place
//= require active_admin/base
+$(document).ready(function() {
+ jQuery(".best_in_place").best_in_place();
+});
Open the Active Admin resource file, put these:
index do
column :number_of_staff do |i|
best_in_place i, :number_of_staff, type: :input, path: [:admin, i]
end
end
with every field you want to enable in-place editing.
And you're good to go. Let me know if I can help.
Tu
qio.me/rebyn
Written by Tu Hoang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#