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

Subsite switching: open page appears to move along to new subsite #489

Open
micschk opened this issue Sep 27, 2022 · 5 comments · Fixed by #490
Open

Subsite switching: open page appears to move along to new subsite #489

micschk opened this issue Sep 27, 2022 · 5 comments · Fixed by #490

Comments

@micschk
Copy link
Contributor

micschk commented Sep 27, 2022

When switching to another subsite while having a specific page open in edit mode, that page will be re-opened in the other subsite as if it has move there. This is confusing and it seems there are also some other issues related to this behaviour. It seems the system just finds the page by its ID and opens it in edit mode (even though it should be filtered out because it belongs to another subsite).

I propose we remove the specific ID (of any currently edited file/folder/page/settings/history/etc) when switching subsites. That way you'd always start with an overview of all pages/files/etc in the subsite you've just switched to.

                    // Switch to listing views of subsite-filtered sections (eg: pages/ & assets/)
                    let newLocHref = window.location.href
                        .split('edit/show/').shift() // remove [pages/]edit/etc
                        .split('settings/show/').shift() // remove [pages/]settings/etc
                        .split('history/show/').shift() // remove [pages/]history/etc
                        .split('show/').shift(); // remove [assets/]show/102/edit/etc (last as 'show' is broad)
                    window.location.href = newLocHref + $.query.set('SubsiteID', $(this).val()).toString();

PR coming up.

@lekoala
Copy link
Contributor

lekoala commented Oct 21, 2022

somehow related, I have a similar issue in modeladmin when switching subsite while editing a record, the record can stay displayed even though you changed the subsite (which can cause lot of isuses).

fixed this by doing this beforeInit

        if ($currentController instanceof ModelAdmin) {
            // We are editing something, move to root
            if (strpos($request->getURL(), '/EditForm/') !== false) {
                return $this->owner->redirect($currentController->Link());
            }
        }

Happy to make a PR if that seems like a solution you would consider, but it's probably not great to do all kind of controller specific logic.
Basically, I think when switching subsite, we should always move to the root of the current section if available, or to the default segment.

@GuySartorelli
Copy link
Member

Fixed in #490. It will be tagged automatically when CI has finished running on the branch.

@GuySartorelli
Copy link
Member

The fix needed to be reverted - see #538

@GuySartorelli
Copy link
Member

@emteknetnz you've just closed this - I think based on the way GitHub references that, it was an accidental automatic closing. Can you please confirm?

@emteknetnz
Copy link
Member

Yeah accidental. I was fixing broken merge-ups at the time

@emteknetnz emteknetnz reopened this Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants