Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options addWrap, deleteWrap, addInsert and formInsert #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

radiac
Copy link

@radiac radiac commented Oct 29, 2014

These changes introduce four new options, with docs and tests:

  • addWrap and deleteWrap let you wrap the add and delete buttons in an element (or multiple nested elements - value is passed to jQuery's .wrap) to make it easier to style the buttons and manage form layout.

  • addInsert is a callback to manage where the add button is inserted. This can be used to put the add button at the top of the forms, or outside the formset altogether.

    My particular use case is that I wanted to style the forms and buttons using CSS li:nth-child(even), and my hidden formTemplate fell between old and new forms, so was knocking the order out; this allows me to put the add button above the hidden formTemplate, rather than at the bottom.

  • formInsert is a callback to manage where and how the form is added. I've used it with jQuery's .slideDown, but would also be used with the addInsert callback to add forms at the top of the formset (see test) or from an add button outside the formset.

Please note though that I only extended the current tests, so they only cover divs, not tables.

I also changed the indentation for formset options in usage.rst - github wasn't displaying anything after the first versionadded.

Also fixed indentation of formset options in usage.rst - github wasn't displaying anything after the first versionadded.
@radiac
Copy link
Author

radiac commented Nov 3, 2014

I think I may have left a bug; line 65 looks for the add button in row.siblings. Think the best way to fix it is to move the add row out into the top level, set it when calling options.addInsert (line ~168 on), then just use the reference at line 65 without looking it up again. Will fix and resubmit.

@radiac
Copy link
Author

radiac commented Nov 5, 2014

Fixed that bug in be80564.

I've also fixed #78 on my branch - sorry it's not a separate pull request!

@thefon
Copy link

thefon commented Feb 14, 2017

Please merge this; I'm keen for the fixed #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants