Add create/edit translation button to editor metabox#607
Open
apermo wants to merge 9 commits intolloc:masterfrom
Open
Add create/edit translation button to editor metabox#607apermo wants to merge 9 commits intolloc:masterfrom
apermo wants to merge 9 commits intolloc:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a 'create new translation' link within the MslsMetaBox for both select and input rendering modes. The implementation includes logic to verify post status, a new private helper method for link generation, and JavaScript to toggle link visibility based on user selection. Review feedback identifies that the for attributes in the generated HTML labels are improperly used to store CSS classes, which violates HTML standards and hinders accessibility; these classes should be moved to a class attribute.
Contributor
Author
Contributor
Author
|
Ty for merging @lloc i'll continue here later |
Update render_select and render_input tests to expect the new create/edit action element and the additional WordPress function mocks.
Add an action button next to each language row in the editor metabox. Shows dashicons-plus when no translation is linked (Quick Create button or classic post-new.php link) and dashicons-external when linked (edit link opening in a new tab). Only visible for saved posts. Closes lloc#606
Hide create button and show edit link when a post is selected via autocomplete. Reverse when the field is cleared.
After Quick Create succeeds in the metabox, use dashicons-external instead of dashicons-edit and open the link in a new tab.
Add styles for create-new and edit-link buttons in the metabox. Move Quick Create button reset and loading animation into the LESS source.
4a886f0 to
04fa5a3
Compare
When get_edit_post_link returns null (post does not exist on the target blog or stale link), show the create button instead of an empty-href edit link.
Contributor
Author
|
still fixing some bugs, will ping when review is finished. |
Add the created post's title to the REST response so the metabox input/select can display it immediately.
Set the autocomplete text input and select option text to the new post's title after a successful Quick Create call.
Contributor
Author
|
@lloc ready for review, feels like magic, i love it :) |
The plugin checker requires the translators comment on the line directly above the __() call.
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.
Closes #606
Summary
dashicons-plus— Quick Create button (when enabled) or classicpost-new.phplink withmsls_id/msls_langparams opening in a new tabdashicons-external— link to the translation's edit page in a new tabdashicons-external(notdashicons-editlike in the listing)forattribute on metabox labels (CSS classes moved toclassattribute)Test plan
post-new.php?msls_id=...&msls_lang=...composer test— 408 tests pass