- January 7, 2010
- Not specified
- admin jquery save
- 2 (after 2 ratings)
This snippet is helpful if you do a lot of editing on a single large admin form (for example, in a rich text field), and want to frequently save your progress. If you press control-S, or command-S on a Mac, the admin change form will save and reload, and the page will scroll back down to where you last were.
This snippet relies on jquery, jquery.cookie, and the shortcut.js keyboard library (which doesn't use jquery, but seemed more robust than the jquery keyboard plugins I saw). It uses a temporary cookie to remember where the page was scrolled to, to avoid having to override the admin behavior.
Note: don't put this in templates/admin/change_form.html -- the circular import causes a Django crash.
Edit: Had forgotten to include jquery.cookie, which I was already including elsewhere.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24