luya-module-cms icon indicating copy to clipboard operation
luya-module-cms copied to clipboard

Deleting menu with submenu

Open luya-bot opened this issue 7 years ago • 9 comments

This issue has originally been reported by @liberosoft at https://github.com/luyadev/luya/issues/1881. Moved here by @nadar.


What steps will reproduce the problem?

During menu deletion with submenu whole branch disappears from admin panel, which is ok, but submenu item stays in the frontend. This submenu item is visible as a root now in the frontend and can't be found in admin panel.

What is the expected result?

Whole branch deleted (marked as is_deleted in database)

What do you get instead? (A Screenshot can help us a lot!)

submenu visible in the frontend

luya-bot avatar Nov 22 '18 09:11 luya-bot

@liberosoft How is the frontend menu build? But yes indeed, it won't delete the nested elements.

nadar avatar Nov 22 '18 09:11 nadar

I'm using code from luya-kickstarter:

                <?php foreach (Yii::$app->menu->findAll([
                    'depth' => 1,
                    'container' => 'default'
                ]) as $item): ?>
                    <li class="nav-item<?= $item->isActive ? ' active' : '' ?>">
                        <a class="nav-link" href="<?= $item->link; ?>"><?= $item->title; ?></a>
                    </li>
                <?php endforeach; ?>

liberosoft avatar Nov 22 '18 10:11 liberosoft

Maybe it is a good idea not to delete nested elements, but they should be able to edit in admin cms panel

liberosoft avatar Nov 22 '18 10:11 liberosoft

But those children are only available if you visite the deleted page - and it should not be possible to open the delete page url anymore...

nadar avatar Nov 22 '18 10:11 nadar

Ok then, I think those children should be marked as deleted, or maybe block parent page deletion if it has children

liberosoft avatar Nov 22 '18 10:11 liberosoft

@luyadev/core @luyadev/maintainer So we are going to delete all children items? This has also a very big potential for frustration when you delete a page accidentally 😄

nadar avatar Feb 27 '19 09:02 nadar

On delete a page with childs all of them should be mark as deleted. And also the user should get a notice that all child pages will be deleted/archived too. It makes no sense that pages are available in frontend but not in backend.

boehsermoe avatar Mar 04 '19 21:03 boehsermoe

I agree with @boehsermoe – I think with a warning it shouldn't be a problem that we delete the pages?

This issue goes hand in hand with #187.

TheMaaarc avatar Mar 05 '19 08:03 TheMaaarc

@TheMaaarc @boehsermoe sounds good to me! So we could add a "special second alert" when a page has children.

nadar avatar Mar 05 '19 08:03 nadar