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

[3.x] Spa #1076

Draft
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Draft

[3.x] Spa #1076

wants to merge 1 commit into from

Conversation

lee-to
Copy link
Collaborator

@lee-to lee-to commented Jun 27, 2024

Works via macro

MenuItem::macro('spa', function () {
    /** @var ModelResource $filler */
    $filler = value($this->getFiller());

    return $this->setUrl(
        fn() => $filler->getFragmentLoadUrl('_content')
    )->changeButton(
        static fn(ActionButton $btn) => $btn->async(selector: '#content')
    );
});

Next, we simply add the spa method to the menu

MenuItem::make(
    static fn () => __('moonshine::ui.resource.admins_title'),
    moonshine()->getContainer(MoonShineUserResource::class)
)->spa(),

TODO

  • Push state (browser history)
  • Set current menu item (mb events)
  • Fix the footer to the bottom
  • Сlick on the active menu again to exclude

prototype
@lee-to lee-to force-pushed the 3.x branch 2 times, most recently from 0235519 to 4d2c71a Compare June 28, 2024 07:09
@lee-to lee-to marked this pull request as draft July 1, 2024 12:29
@lee-to lee-to force-pushed the 3.x branch 3 times, most recently from ed3e696 to 8a66cf5 Compare July 19, 2024 13:42
@lee-to lee-to force-pushed the 3.x branch 2 times, most recently from 6fa186f to bc3c799 Compare July 19, 2024 13:42
@lee-to lee-to force-pushed the 3.x branch 4 times, most recently from c7b59d8 to d9532c2 Compare July 28, 2024 09:25
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.

1 participant