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

Recalculate menu order on insertion or deletion #275

Merged
merged 4 commits into from
Jan 13, 2022

Conversation

petruchek
Copy link
Contributor

New private method called reorder_menu_items() which is being called after any menu item is being deleted or new menu item is being added and it has explicitly set position.

Issue reported and briefly discussed here: #493

@petruchek
Copy link
Contributor Author

Hi there @schlessera

Any news on this PR being merged?

Thanks

@schlessera
Copy link
Member

Hi @petruchek,

Yes, I'd like to move this forward. However, we'll need Behat tests for this first. Can you add tests to assert that the menu IDs are correctly modified?

Let me know if you need assistance with writing the tests!

@petruchek
Copy link
Contributor Author

Let me know if you need assistance with writing the tests!

@schlessera, thank you for your response.

Could you please guide me a little, please?

I'm assuming I need to modify features/menu-item.feature. Is this correct?
Do you think I need to create a separate scenario? Or I should modify existing scenarios?

Thank you for your time (very much)

@schlessera
Copy link
Member

@petruchek

I'm assuming I need to modify features/menu-item.feature. Is this correct?

Yes, that's the one to edit.

Do you think I need to create a separate scenario? Or I should modify existing scenarios?

Please create a separate scenario. In the existing tests, you can already see how the position is being represented in the output lists, so it should be relatively straight-forward to copy one of the existing scenarios and adapt it to test this PR.

@petruchek
Copy link
Contributor Author

petruchek commented Feb 12, 2021

@petruchek

I'm assuming I need to modify features/menu-item.feature. Is this correct?

Yes, that's the one to edit.

Do you think I need to create a separate scenario? Or I should modify existing scenarios?

Please create a separate scenario. In the existing tests, you can already see how the position is being represented in the output lists, so it should be relatively straight-forward to copy one of the existing scenarios and adapt it to test this PR.

Hi there @schlessera,

Is it something that still makes sense doing? Please let me know.

@schlessera
Copy link
Member

Hey @petruchek,
Yes, this still makes sense.

@schlessera schlessera changed the title Wp cli issue 5047 Recalculate menu order on insertion or deletion Jan 13, 2022
@schlessera
Copy link
Member

Thanks for the PR, @petruchek !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants