Added options addWrap, deleteWrap, addInsert and formInsert#80
Open
radiac wants to merge 3 commits intoelo80ka:masterfrom
Open
Added options addWrap, deleteWrap, addInsert and formInsert#80radiac wants to merge 3 commits intoelo80ka:masterfrom
radiac wants to merge 3 commits intoelo80ka:masterfrom
Conversation
Also fixed indentation of formset options in usage.rst - github wasn't displaying anything after the first versionadded.
Author
|
I think I may have left a bug; line 65 looks for the add button in |
Author
|
Please merge this; I'm keen for the fixed #78 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These changes introduce four new options, with docs and tests:
addWrapanddeleteWraplet 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.addInsertis 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 hiddenformTemplatefell between old and new forms, so was knocking the order out; this allows me to put the add button above the hiddenformTemplate, rather than at the bottom.formInsertis 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 theaddInsertcallback 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.