whitecube / nova-page

Static pages content management for Laravel Nova
https://whitecube.github.io/nova-page
MIT License
238 stars 41 forks source link

Panel only working in details overview #14

Closed wimurk closed 5 years ago

wimurk commented 5 years ago

In the docs you mentioned that the fields and cards definition is exactly the same as regular Laravel Nova Resources. In the laravel navo resource can add cards to the edit page. Like the image below

new Panel('Pagina informatie', $this->BaseAttributes()),

I can't figure out how this works with this package. Can you provide a code sample or edit the docs?

voidgraphics commented 5 years ago

Hello, I am not sure what you mean exactly. That screenshot does not have any cards in it, it has Panels, which are defined exactly how you mentioned.

Here's an example of a nova-page template with a Panel:

namespace App\Nova\Templates;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Panel;
use Whitecube\NovaPage\Pages\Template;

class About extends Template
{

    /**
     * Get the fields displayed by the resource.
     *
     * @param  \Illuminate\Http\Request $request
     * @return array
     */
    public function fields(Request $request)
    {
        return [
            new Panel('Pagina informatie', $this->somePageFields()),
        ];
    }

    protected function somePageFields()
    {
        return [
            Text::make('Title'), // ...
        ]
    }

    /**
     * Get the cards available for the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function cards(Request $request)
    {
        return [];
    }
}
wimurk commented 5 years ago

@voidgraphics Yes i meant panels. I am kinda new to nova and its components. The panels are only showed when viewing the page in detail and not when editing one. Would be nice if there were panels to when editing a page.

voidgraphics commented 5 years ago

Indeed it would be nice. This is an issue with Laravel Nova though: https://github.com/laravel/nova-issues/issues/29

toonvandenbos commented 5 years ago

The good news is that the issue @voidgraphics mentioned has the planned tag applied to it.

@wimurk in the meantime you could use the official Heading field in order to add a little bit more structure to the edit pages. Hope this helps!

wimurk commented 5 years ago

Yes that helps. The heading field isn't released yet so i will have to wait till laravel/nova-issues#29 is releases