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

Set Parent from Page Settings screen #19021

Closed

Conversation

salimbraksa
Copy link
Contributor

@salimbraksa salimbraksa commented Jul 9, 2022

Issues

Closes #13150

Testing Instructions

TBD

Screen Recordings

Regression Notes

  1. Potential unintended areas of impact
    TBD

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    TBD

  3. What automated tests I added (or what prevented me from doing so)
    TBD

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

- ParentPageSettingsViewController can either have a "Cancel" button or "Back" button.
- ParentPageSettingsViewController can be configured to set page.parentID locally or remotely.
- ParentPageSettingsViewController cna be dismissed automatically when the user selects a page parent.

/// Provides an API to access the current parent of a page, and list of parent pages available for editing.
///
@objc class ParentPagesController: NSObject {
Copy link
Contributor Author

@salimbraksa salimbraksa Jul 9, 2022

Choose a reason for hiding this comment

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

I needed a way to access the parent pages that can be selected for a child page. So that I display them later in "Set Page" screen.

The good news is that this logic is already implemented in PageListTableViewHandler. The bad news is that the class is tightly coupled with PageListViewController's table view. So I couldn't re-use that class elsewhere.

The solution was to read PageListTableViewHandler and extract only the code that fetches a page's parents available for editing. Then put that logic in a new class that I called ParentPagesController. This class doesn't depend on any view and be used anywhere.

You can see how this class is used in PageSettingsViewController.

Let me know what you think. 🙏

@salimbraksa salimbraksa closed this Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to set parent to Page Settings in editor
1 participant