Skip to content
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

Meta Boxes: Allow collapsing/sorting the meta boxes panels #4434

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

youknowriad
Copy link
Contributor

This PR enables the meta boxes collapsing/sorting behavior we have in the classic editor.
It's as simple as calling window.postboxes.add_postbox_toggles( 'post' ); when we load the meta boxes.

Testing instructions

  • Add some metaboxes
  • Notice you can collapse/expand the panels

@youknowriad youknowriad added the [Feature] Meta Boxes A draggable box shown on the post editing screen label Jan 12, 2018
@youknowriad youknowriad self-assigned this Jan 12, 2018
Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that this uses a different persistence mechanism than the reducer preferences, so if one is cleared and the other not, some but not all "preferences" will be reset. I think it's fine enough for now.

@@ -452,4 +452,10 @@ export default {
const message = spokenMessage || content;
speak( message, 'assertive' );
},
INITIALIZE_META_BOX_STATE( action ) {
// Allow toggeling metaboxes panels
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "toggeling" -> "toggling"

@@ -452,4 +452,10 @@ export default {
const message = spokenMessage || content;
speak( message, 'assertive' );
},
INITIALIZE_META_BOX_STATE( action ) {
// Allow toggeling metaboxes panels
if ( some( action.metaBoxes ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: some is reasonable enough; isEmpty is maybe a bit more accurate to what you're testing, particularly since you're not providing a predicate for some.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, isEmpty doesn't work here because it's an object like this { side: true, normal: false }. isEmpty always returns false in this case.

@bobbingwide
Copy link
Contributor

I merged this PR into my development system and all the problems I mentioned in #4532 have been resolved.

@youknowriad
Copy link
Contributor Author

Travis is down for a long time now, I'm going to merge. Unit tests pass locally.

@youknowriad youknowriad merged commit 47c36a5 into master Jan 17, 2018
@youknowriad youknowriad deleted the fix/metaboxes-collapsing-sorting branch January 17, 2018 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Meta Boxes A draggable box shown on the post editing screen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants