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

Getting 2 Sidebars or double templates when clicking links created with Menu admin #184

Open
Ivan-DaGreat-LT opened this issue Sep 3, 2024 · 1 comment

Comments

@Ivan-DaGreat-LT
Copy link

Ivan-DaGreat-LT commented Sep 3, 2024

Describe the bug
I created a new menu item via the Menu admin, whenever I click the new menu item, I get the correct page but it is wrapped in the template twice. So I am seeing 2 Sidebars and 2 Headers (See attached photo)
Screenshot 2024-09-03 at 4 42 09 PM

I am using the Grid/List view.
I tried just returning the grid() method with no luck, and now I return the index() method with $this->grid() in the body property.

Index Method

public function index(Content $content)
    {
        return Admin::content(function (Content $content) {
            $content
                ->title('New Page')
                ->description('List of Items')
                ->breadcrumb(
                    ['text' => 'Dashboard', 'url' => '/admin'],
                    ['text' => 'New Page']
                )
                ->body($this->grid());
        });
    }

Grid Method:

protected function grid()
    {
        $grid = new Grid(new Pages());
        $grid->column('page_id', 'ID')->sortable();
        $grid->column('page_name', 'Page')->sortable();
        $grid->column('created_at', 'Created At')->display(function ($createdDate) {
            return date(DateFormat, strtotime($createdDate));
        })->sortable();
        $grid->column('updated_at', 'Updated At')->display(function ($createdDate) {
            return date(DateFormat, strtotime($createdDate));
        })->sortable();

        $grid->filter(function ($filter) {
            $filter->like('page_name', 'Page');
        });

        $grid->actions(function ($actions) {
            $actions->disableView();
        });

        $grid->batchActions(function ($batch) {
            $batch->disableDelete();  // Disable the batch delete button
        });

        return $grid;
    }
@Tech-Loyal
Copy link

Greetings, have you managed to fix this error? The same thing is happening to me. =(
But when I refresh the page, the correct information is displayed.

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

No branches or pull requests

2 participants