Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
feb6f87
Make actions available in a collection tree view
Devsome Mar 24, 2026
6dc7141
fix: duplicate deletion removed
Devsome Mar 24, 2026
5561d3f
Merge branch 'statamic:6.x' into 6.x
Devsome Mar 25, 2026
ff414fa
Merge branch 'statamic:6.x' into 6.x
Devsome Mar 26, 2026
9867b35
Merge branch 'statamic:6.x' into 6.x
Devsome Mar 29, 2026
d84b469
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 2, 2026
ae30a9a
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 7, 2026
d87a18c
[6.x] add the autoLoad option to ItemActions and load actions when th…
Devsome Apr 7, 2026
ccaf0d9
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 8, 2026
9c8419a
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 9, 2026
f5a3e1a
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 14, 2026
fd21681
[6.x] fixed modal after action click and variant to default instead o…
Devsome Apr 14, 2026
7be9048
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 15, 2026
a623274
[6.x] Add branch-options-dropdown slot and modal prop to support conf…
Devsome Apr 15, 2026
8763761
Merge branch 'statamic:6.x' into 6.x
Devsome Apr 17, 2026
cbd5921
Merge branch 'statamic:6.x' into 6.x
Devsome May 5, 2026
23b5fcc
Merge branch 'statamic:6.x' into 6.x
Devsome May 11, 2026
a9dcc8b
Merge branch 'statamic:6.x' into 6.x
Devsome May 12, 2026
47a052b
Merge branch 'statamic:6.x' into 6.x
Devsome May 15, 2026
11f5cd9
Merge branch 'statamic:6.x' into 6.x
Devsome Jun 9, 2026
bee0ed7
Merge branch 'statamic:6.x' into 6.x
Devsome Jun 16, 2026
b547828
Merge branch 'statamic:6.x' into 6.x
Devsome Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion resources/js/components/actions/ItemActions.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { ref, computed, useTemplateRef, watch } from 'vue';
import { ref, computed, useTemplateRef, watch, onMounted } from 'vue';
import useActions from './Actions.js';
import ConfirmableAction from './ConfirmableAction.vue';
import useSkeletonDelay from '@/composables/skeleton-delay.js';
Expand All @@ -11,6 +11,7 @@ const props = defineProps({
context: { type: Object, default: () => ({}) },
item: { required: true },
isDirty: { type: Boolean, default: false },
autoLoad: { type: Boolean, default: false },
});

const emit = defineEmits(['started', 'completed']);
Expand All @@ -24,6 +25,10 @@ const loading = ref(false);
const shouldShowSkeleton = useSkeletonDelay(loading);
let loadActionsRequest = null;

onMounted(() => {
if (props.autoLoad) loadActions();
});

watch(
() => props.actions,
() => {
Expand Down
32 changes: 20 additions & 12 deletions resources/js/components/structures/Branch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,26 @@

<slot name="branch-icon" :branch="page" />

<template v-if="editable">
<Dropdown placement="left-start" :class="{ invisible: isRoot }">
<DropdownMenu>
<slot
name="branch-options"
:branch="page"
:depth="depth"
:remove-branch="remove"
/>
</DropdownMenu>
</Dropdown>
</template>
<template v-if="editable">
<slot
name="branch-options-dropdown"
:branch="page"
:depth="depth"
:remove-branch="remove"
:is-root="isRoot"
>
<Dropdown placement="left-start" :class="{ invisible: isRoot }">
<DropdownMenu>
<slot
name="branch-options"
:branch="page"
:depth="depth"
:remove-branch="remove"
/>
</DropdownMenu>
</Dropdown>
</slot>
</template>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/structures/PageTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<template #branch-options="props">
<slot name="branch-options" v-bind="{ ...props, stat }" />
</template>

<template #branch-options-dropdown="props">
<slot name="branch-options-dropdown" v-bind="{ ...props, stat }" />
</template>
</tree-branch>
</template>
</Draggable>
Expand Down
4 changes: 3 additions & 1 deletion resources/js/components/ui/Dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ defineOptions({
const attrs = useAttrs();

const props = defineProps({
/** Whether the dropdown should behave as a modal and hide outside content from assistive tech. */
modal: { type: Boolean, default: true },
/** The preferred alignment against the trigger. May change when collisions occur. <br><br> Options: `start`, `center`, `end` */
align: { type: String, default: 'start' },
/** The distance in pixels from the trigger */
Expand All @@ -29,7 +31,7 @@ const dropdownContentClasses = cva({
</script>

<template>
<DropdownMenuRoot>
<DropdownMenuRoot :modal="modal">
<DropdownMenuTrigger as-child data-ui-dropdown-trigger>
<slot name="trigger">
<Button icon="dots" variant="ghost" size="sm" v-bind="attrs" :aria-label="__('Open dropdown menu')" />
Expand Down
113 changes: 93 additions & 20 deletions resources/js/pages/collections/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,93 @@
/>
</template>

<template #branch-options="{ branch, removeBranch, depth }">
<template v-if="depth < structureMaxDepth">
<DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" />
<DropdownItem
v-for="blueprint in blueprints"
@click="createEntry(blueprint.handle, branch.id)"
:icon="blueprint.icon || 'add-entry'"
:key="blueprint.handle"
:text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')"
/>
</template>
<DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" />
<DropdownItem
v-if="branch.can_delete"
:text="__('Delete')"
icon="trash"
variant="destructive"
@click="deleteTreeBranch(branch, removeBranch)"
/>
<template #branch-options-dropdown="{ branch, removeBranch, depth, isRoot }">
<ItemActions
v-if="branch.entry"
:url="entriesActionUrl"
:context="{ view: 'tree' }"
:item="branch.entry"
v-slot="{ actions, loadActions, shouldShowSkeleton }"
>
<Dropdown
@mouseover="loadActions"
@focus="loadActions"
@click="loadActions"
placement="left-start"
:modal="false"
:class="{ invisible: isRoot }"
>
<DropdownMenu>
<template v-if="depth < structureMaxDepth">
<DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" />
<DropdownItem
v-for="blueprint in blueprints"
@click="createEntry(blueprint.handle, branch.id)"
:icon="blueprint.icon || 'add-entry'"
:key="blueprint.handle"
:text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')"
/>
</template>

<DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" />

<DropdownItem
v-if="branch.can_delete"
:text="__('Delete')"
icon="trash"
variant="destructive"
@click="deleteTreeBranch(branch, removeBranch)"
/>

<DropdownSeparator v-if="shouldShowSkeleton || branchTreeActions(actions).length" />

<template v-if="shouldShowSkeleton">
<div v-for="index in 3" :key="index" class="contents">
<Skeleton class="m-1 size-5" />
<Skeleton
class="mx-2 my-1.5 h-5"
:class="index === 1 ? 'w-28' : index === 2 ? 'w-36' : 'w-24'"
/>
</div>
</template>
<template v-else>
<DropdownItem
v-for="action in branchTreeActions(actions)"
:key="action.handle"
:text="__(action.title)"
:icon="action.icon"
:variant="action.dangerous ? 'destructive' : 'default'"
@click="action.run"
/>
</template>
</DropdownMenu>
</Dropdown>
</ItemActions>

<Dropdown v-else placement="left-start" :modal="false" :class="{ invisible: isRoot }">
<DropdownMenu>
<template v-if="depth < structureMaxDepth">
<DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" />
<DropdownItem
v-for="blueprint in blueprints"
@click="createEntry(blueprint.handle, branch.id)"
:icon="blueprint.icon || 'add-entry'"
:key="blueprint.handle"
:text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')"
/>
</template>

<DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" />

<DropdownItem
v-if="branch.can_delete"
:text="__('Delete')"
icon="trash"
variant="destructive"
@click="deleteTreeBranch(branch, removeBranch)"
/>
</DropdownMenu>
</Dropdown>
</template>
</page-tree>

Expand Down Expand Up @@ -190,7 +258,7 @@ import DeleteLocalizationConfirmation from '@/components/collections/DeleteLocal
import CollectionCalendar from '@/components/entries/calendar/Calendar.vue';
import SiteSelector from '@/components/SiteSelector.vue';
import { defineAsyncComponent } from 'vue';
import { Dropdown, DropdownItem, DropdownLabel, DropdownMenu, DropdownSeparator, Header, Button, ToggleGroup, ToggleItem } from '@/components/ui';
import { Dropdown, DropdownItem, DropdownLabel, DropdownMenu, DropdownSeparator, Header, Button, Skeleton, ToggleGroup, ToggleItem } from '@/components/ui';
import ItemActions from '@/components/actions/ItemActions.vue';
import Head from '@/pages/layout/Head.vue';
import { router } from '@inertiajs/vue3';
Expand All @@ -206,6 +274,7 @@ export default {
Dropdown,
Header,
Button,
Skeleton,
ToggleGroup,
ToggleItem,
PageTree: defineAsyncComponent(() => import('@/components/structures/PageTree.vue')),
Expand Down Expand Up @@ -397,6 +466,10 @@ export default {
return branch.redirect != null;
},

branchTreeActions(actions) {
return (actions || []).filter((action) => action.handle !== 'delete');
},

createEntry(blueprint, parent) {
let url = `${this.createUrl}?blueprint=${blueprint}`;
if (parent) url += '&parent=' + parent;
Expand Down
13 changes: 7 additions & 6 deletions src/Structures/TreeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,23 @@ protected function transformTreeForController($tree)
$page = $item['page'];
$collection = $page->mountedCollection();
$referenceExists = $page->referenceExists();
$entry = $referenceExists ? $page->entry() : null;

return [
'id' => $page->id(),
'entry' => $page->reference(),
'title' => $page->hasCustomTitle() ? $page->title() : null,
'entry_title' => $referenceExists ? $page->entry()->value('title') : null,
'entry_blueprint' => $referenceExists ? [
'handle' => $page->entry()->blueprint()->handle(),
'title' => $page->entry()->blueprint()->title(),
'entry_title' => $entry ? $entry->value('title') : null,
'entry_blueprint' => $entry ? [
'handle' => $entry->blueprint()->handle(),
'title' => $entry->blueprint()->title(),
] : null,
'url' => $page->url(),
'edit_url' => $page->editUrl(),
'can_delete' => $referenceExists ? User::current()->can('delete', $page->entry()) : true,
'can_delete' => $entry ? User::current()->can('delete', $entry) : true,
'slug' => $page->slug(),
'status' => $referenceExists ? $page->status() : null,
'redirect' => $referenceExists ? $page->entry()->get('redirect') : null,
'redirect' => $entry ? $entry->get('redirect') : null,
'collection' => ! $collection ? null : [
'handle' => $collection->handle(),
'title' => $collection->title(),
Expand Down
Loading