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
[notready] [medium] Fix and enhance repeat groups. #1939
base: master
Are you sure you want to change the base?
[notready] [medium] Fix and enhance repeat groups. #1939
Conversation
1. Use -1 as maximum repeat group not set instead of zero in order to distinguish between use of a field to define number of rows which holds zero from maximum not set in Fabrik Group settings. 2. Trigger duplicateGroupsToMin when elements have been added rather than on timer. 3. Handle reduction correctly in duplicateGroupsToMin. 4. Set min/max in watchRepeatNums not just when field changes.
1. Move form / details "show group" to be with list / query "show group" from Layout tab to Details tab. Tweak language strings. 2. Split number of repeats element field into min and max repeat element fields - in XML, group model, template, JS and language strings. Backwards compatibility is handled in both front- and back-ends.
... because this is contrary to Bootstrap style and gives the user the impression that the buttons are disabled. I have commented this out rather than deleted the code in the event that users complain and we need to add a group option to enable / disable the fade.
... depending in min / max repeats allowed. And tweak CSS for repeat group buttons.
... and to trigget chosen update if needed. Note: Chosen appears to update already in my tests, but that may simply be due to how my element JS to make it readonly is sequenced compared to the JS which chosen-ifies it.
1. It is run explicitly in form.js 2. It is not included in any elements which override this method.
... e.g. if original was readonly or disabled. NOTE: Chosen update method does not appear to work.
I have tried to work out how to replicate the tooltips when adding a new repeat. The jQuery / tipsBootStrapMock code takes the title attribute off, and it seems impossible to get hold of it to add it to the new cloned version. I thought about adding Add/Delete group messages as fixed JS strings, which would work because they are fixed, but we could not use this for e.g. validation tooltips which are per element. I also tried to save the title as an HTML attribute on the tooltip bearing tag which will then be cloned with changes in tipBootstrapMock but it wouldn't add it for some reason. So it seems like we need to feed the validation tooltip definitions into the element javascript so that they can be set programatically - but doing tooltips as part of the element js is a fundamental change of design that I am not going to do here. I will, however, add fixed tooltip text for the add/delete buttons. |
1. Stop visible Add tooltip being cloned. 2. Add tooltips to cloned Add/Delete buttons.
This PR is not ready for review. I need to prevent a new first repeat row being hidden if there are validation errors on it (rather than it being pristine). |
... and distinguish between development errors (which are onlu shown with debug on) and run-time errors which are shown always.
Ok - now it is ready for review and merge. |
0b11d63
to
7fb6849
Compare
By copying the title into a preserve-title attribute, when the element is cloned we are able to reinstate the tooltip.
fa7f9f5
to
9f40a6b
Compare
We run a load event when we add a new subgroup (but not when we unhide it), so we need to run a matching unload event when we delete a subgroup (but not when we hide it).
9f40a6b
to
5a6064a
Compare
An example of what can be done now we have an unload even on row delete can be found in: http://fabrikar.com/forums/index.php?wiki/dropdown-selections-unique-in-repeat-group/&noRedirect=1 |
...and move multipage setting to the Layout tab, which makes sense.
e7fa52b
to
2da09d6
Compare
Otherwise if e.g. we have a load event to clear the element, the HTML to clear does not exist and e.g. this.formElements.get(id) in the clear event cannot find the element to clear.
... and implement a clear function.
... and reduce code nesting.
There have been reports of some JS actions not working on some element types, so it might be sensible to add these fixes to this before it is merged. Needs completion of a dedicated comprehensive test list / form, more testing and probably fixes for further current Fabrik issues once comprehensive testing has identified any other missing functionality. |
Fix repeat group min/max functionality where min of zero was not working consistently.
Split Repeat number element into min and max with full backward compatibility
Remove fade of repeat add/remove buttons because not consistent with Bootstrap usage.
Disable add / remove buttons when max/min reached - plus CSS tweaks to make it look better.
Fixing Chosen dropdowns so that the close is reset to as new.
Avoid double resetEvent called from both form.js and inside element.js.
Replicate tooltips correctly. Element tooltips are correctly cloned, add / delete buttons have tips applied and Add tip is no longer cloned if displayed when Add is clicked.
If you allow zero repeat rows and are attempting to add a first repeat row with a validation error, the row is no longer hidden after failed submission.
Elements now get an unload event when you delete a repeat group row.