-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigation Editor: Fix saving locations using the "Manage Locations" …
…popup (#34714) * Create SaveButton component. It's needed to save menu locations. * Fix code style. * Remove SaveButton component. It's better to put all "save" related logic into the manage-locations component. * Implement a function that sends batch requests to update menu locations. * 1. Fix request path for __experimental/menus route. 2. Small refactoring. * Fix code style. * Allow batch requests for `__experimental/menus` endpoints because we need to use batch API to save menus' locations in the Manage Locations popup. * 1. Display an error or a success message when updating menus' locations. 2. Fix css classname for the save button. * Add async/await to be sure we return get response instead of a Promise. * Move "save" button to the right. * In this context "Update" is better than "Save". * Increase unit test code coverage by adding a unit test for WP_REST_Menus_Controller_Test. * There was a type in the method's name. We need to rename it. * Fix code style. * 1. Export createBatch function so that it can be used externally. * 1. Refactor Manage Locations and use createBatch function to send batches to the batch REST API endpoint. The previous method doesn't properly parse error responses. * Update lib/class-wp-rest-menus-controller.php Co-authored-by: Jonny Harris <[email protected]> * Fix parent class name. * Fix code style. * Add default domain for translation because lint-php check fails. * Fix the unit test. * Move the test to the REST_Nav_Menus_Controller_Test. * 1. We need to place this public method before protected and private methods, so I'm just moving it above them. 2. Update test fail message. * Revert "1. We need to place this public method before protected and private methods, so I'm just moving it above them." This reverts commit 400236d305ca4cb18da40f568c1bb09bd0231a38. * Revert "Move the test to the REST_Nav_Menus_Controller_Test." This reverts commit 72440411ad261191987c856de041a7be19962783. * Fix the test. * Fix the error inside the WP_REST_Menus_Controller::register_routes * Revert "1. Export createBatch function so that it can be used externally." This reverts commit b7fc4a12a2bd4353c131b994eff8fdc1d202cf5b. * Refactor locations update logic and revert to apiFetch. We can't use createBatch function from wordpress/core-data. * Fix the import statement. * Move the test to the REST_Nav_Menus_Controller_Test. * Fix code style. Co-authored-by: Jonny Harris <[email protected]>
- Loading branch information
1 parent
f74bbde
commit b686c45
Showing
4 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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