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

Respect Panels and Panel order on edit page #85

Closed
BenjaminBrandtner opened this issue Jan 9, 2020 · 3 comments
Closed

Respect Panels and Panel order on edit page #85

BenjaminBrandtner opened this issue Jan 9, 2020 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@BenjaminBrandtner
Copy link

On my User Resource I use one Tabs-Component and one standard Nova Panel, like this:

    public function fields(Request $request)
    {
        return [
            new Tabs(__('Personal Details'), $this->getPersonalDetailsFields($request)),
            new Panel(__('Game Details'), $this->getGameDetailsFields($request)),
        ];
    }

On the detail page, two cards are displayed, with the Personal Details at the top and the Game Details at the bottom, as expected.

On the edit page however, just one card is displayed, with the Game Details at the top, then the tab bar, then the Personal Details fields.
It looks like this screenshot from potentially related issue #14.

My desired behaviour is for the edit page to look exactly like the detail page, one card for the Tab-component, one card for the Panel-component, in the same order that they are declared in the source code. Is this possible?

@alexrififi
Copy link
Contributor

This is because method updateFields in trait TabsOnEdit return only one field in FieldCollection

    /**
     * Resolve the update fields.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest $request
     * @return \Laravel\Nova\Fields\FieldCollection
     */
    public function updateFields(NovaRequest $request)
    {
        return new FieldCollection(
            [
                'Tabs' => [
                    'component' => 'tabs',
                    'fields'    => $this->removeNonUpdateFields($request, $this->resolveFields($request)),
                    'panel'     => Panel::defaultNameForUpdate($request->newResource()),
                ],
            ]
        );
    }

@RVxLab
Copy link
Collaborator

RVxLab commented Oct 19, 2020

I'd need to take a look how this could be implemented correctly. Due to limited time that might be a while. If you want to take a crack at it yourself please feel free to do so.

@elijahworkz
Copy link
Contributor

I added a pull request that solves this issue. #139

@RVxLab RVxLab closed this as completed in 1adf95e Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants