-
Notifications
You must be signed in to change notification settings - Fork 573
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
Add confirm dialog to group Remove button #1208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things I would like to see:
- Use the
remove_confirm
field default as a string (just like the'remove_button'
above it, and then set that string in thedata-confirm
attribute, and use THAT for the confirmation dialog text. That allows users to define the confirmation text via field configuration instead of filtering the text via thecmb2_localized_data
filter. - Use an empty string for the
data-confirm
attribute to indicate it should not be used. (instead of "no") - Follow the JS convention -- one var per line, per variable assignment.
1) make confirmation ON by default 2) confirmation text is now configurable when defining the group field 3) remove newly added string from l10n JS object (not used anymore) 4) support a case when group field renderer was redefined and doesn't have `data-confirm` attribute at all 5) fix tests
@jtsternberg Those changes were implemented. I'm not sure what is a procedure in this project in this case (should I dismiss your initial review, or wait till you check your GH notifications for new commits etc) - so I'm just pinging you, just in case. |
…ault empty (to not break back-compat)
I just updated the docs. |
* upstream/develop: make use of phpunit 6.5 for PHP 5.6. fix failing test for group removal confirmation message. Add props for CMB2#1208 Move the remove_confirm option to the example functions and leave default empty (to not break back-compat) Oops, fix typeof yoda check Fix removal confirmation in tests Simplify removal confirmation check Update typeof checks to use yoda make remove confirmation a bit more succinct Cannot use empty on an operation on older versions of php see CMB2#529 - improvements as per PR review: see CMB2#529 - fix tests with a default confirm value in DOM equal to no. fix CMB2#529 - Add confirm dialog to group Remove button. Add props for CMB2#1206 Add php tests npm script Add grunt watch npm script Add props for CMB2#1204 Ignore composer vendor dir fix CMB2#1205 - Package.json: fix the need of global (old) grunt. fix 1023 - Update PHPUnit version in composer.json. Add props for CMB2#1200 Remove superfluous method definitions Add develop class suffix to init.php class Bump version for hotfix release Fix issue when wp.data does not have core/editor. Check it first. Fixes CMB2#1197 Update version to 2.5.0 Update changelog Make install-wp-tests.sh executable Update tests to pass Add cmb_init_pickers and cmb_init_code_editors events for allowing just-in-time configuration for pickers/editors Make CMB2.getFields/CMB2.getFields more robust, allowing a filter callback, and specifying by field id
Fixes #529.
Changes proposed in this pull request
added new option
remove_confirm
to the custom options list forgroup
field type;false
by default - so all the current installations will not see any difference, should be enabled to be usedadded
group_remove_confirm
- new translatable string to JS-based l10n list to display the test using JSdisplay a default browser
confirm()
modal window and a custom (filterable) text from above when a user tries to delete a group of fields. If the user agrees - process further with the old logic, if denied - nothing happens.Documentation should be updated here.