-
Notifications
You must be signed in to change notification settings - Fork 920
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
[Feature][3.3] Add a toggle other field depending of the selected value of the based on the select2 value. #1257
Conversation
… field : select2_from_array (based on PR Laravel-Backpack#165 PR of @OwenMelbz)
BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly. Please keep in mind that:
Thank you! -- |
Hi @mamarmite , Thanks a lot for the contribution (and the praise). I'll test & review this shortly and decide whether to merge this or @OwenMelbz 's #165 PR. I think it's high time we provide a solution for this problem. Cheers! |
…om file. Added crud-field-trait-toggable.js to be able to use it as a trait (kinda).
make global vars more viewable with g_ ? or find an ES6 convention ready.CRUD/src/public/crud/js/crud-field-trait-toggable.js Lines 24 to 29 in 9247f58
This comment was generated by todo based on a
|
I change the code to use the code as a jquery plugin (version 0.5) |
I test it with a checklist field too. I created a GIST to show how I made it. Feel free to reimplement everything. The jquery plugin is V 0.5, first implementation that work for my case. Need confronting more problems to solve. Anyhow, I keep it here. Thanks again. Great community and reactivity :) |
…checkfield is checked. #Need-refactoring : to make it easier to read.
This was more a gist than a PR. Closing this. |
@mamarmite this is it. It's time we actually provide a solution for this, in the Backpack core. What do you think of the idea in #4158 ? Can't tell if it's incredibly good or incredibly stupid. Thank you 🙏 |
Based on PR #165 by @OwenMelbz and the original select2_from_array.
Actually, I adapted the logic to a WhiteList pattern instead of blacklist patterns. Because Select field can be huge. This would be more of a proof of concept.
todo : Improve it by made that a behaviour as a property for fields.
That can be added as a plugin loaded if the field have the feature or not.
Like :
This kind of behaviour is good to limit the confusion for the user.
Anyhow, I pushed it here, to share, feel free to do anything with it. Love the product :)