Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions resources/js/components/inputs/relationship/Selector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<template #cell-status="{ row: entry }">
<StatusIndicator :status="entry.status" show-label :show-dot="false" />
</template>
<template #cell-type="{ value }">
<Badge :text="value" />
</template>
</Table>
<PanelFooter>
<Pagination />
Expand Down Expand Up @@ -136,6 +139,7 @@ import {
Checkbox,
Icon,
StatusIndicator,
Badge,
} from '@/components/ui';

export default {
Expand All @@ -154,6 +158,7 @@ export default {
Checkbox,
Icon,
StatusIndicator,
Badge,
},

// todo, when opening and closing the stack, you cant save?
Expand Down
7 changes: 0 additions & 7 deletions resources/js/components/ui/Listing/TableBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ function handleRowClick(event, index) {
/>
</slot>
</td>
<!-- <td class="type-column" v-if="type">
<Badge
size="sm"
v-if="type === 'entries' || type === 'terms'"
:label="type === 'entries' ? __(row.collection.title) : __(row.taxonomy.title)"
/>
</td> -->
<td class="actions-column" v-if="hasActions || $slots['prepended-row-actions']">
<RowActions :row="row">
<template v-if="$slots['prepended-row-actions']" #prepended-actions="{ row }">
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Resources/CP/Entries/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function columnPreferenceKey($key)
return $this;
}

private function setColumns()
protected function setColumns()
{
$columns = $this->blueprint->columns();

Expand Down
20 changes: 20 additions & 0 deletions src/Http/Resources/CP/Entries/EntriesFieldtypeEntries.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Http\Resources\CP\Entries;

use Illuminate\Pagination\AbstractPaginator;
use Statamic\CP\Column;
use Statamic\Fieldtypes\Entries as EntriesFieldtype;

class EntriesFieldtypeEntries extends Entries
Expand All @@ -29,4 +30,23 @@ protected function collectResource($resource)

return $collection;
}

protected function setColumns()
{
parent::setColumns();

$columns = $this->columns;

$type = Column::make('type')
->label(__('Collection'))
->listable(true)
->defaultVisibility(true)
->visible(true)
->sortable(true)
->defaultOrder($columns->count() + 1);

$columns->put('type', $type);

$this->columns = $columns->rejectUnlisted()->values();
}
}
4 changes: 3 additions & 1 deletion src/Http/Resources/CP/Entries/ListedEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ protected function values($extra = [])
$key = $column->field;
$field = $this->blueprint->field($key);

if ($key === 'site') {
if ($key === 'type') {
return [$key => $this->resource->collection()->title()];
} elseif ($key === 'site') {
$value = $this->resource->locale();
} else {
$value = $extra[$key] ?? $this->resource->value($key) ?? $field?->defaultValue();
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Resources/CP/Taxonomies/ListedTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function values($extra = [])
$key = $column->field;
$field = $this->blueprint->field($key);

if ($key == 'taxonomy') {
if ($key == 'type') {
return [$key => $this->resource->taxonomy()->title()];
} else {
$value = $extra[$key] ?? $this->resource->value($key) ?? $field?->defaultValue();
Expand Down
15 changes: 1 addition & 14 deletions src/Http/Resources/CP/Taxonomies/Terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Statamic\Http\Resources\CP\Taxonomies;

use Illuminate\Http\Resources\Json\ResourceCollection;
use Statamic\CP\Column;
use Statamic\Http\Resources\CP\Concerns\HasRequestedColumns;

class Terms extends ResourceCollection
Expand All @@ -29,22 +28,10 @@ public function columnPreferenceKey($key)
return $this;
}

private function setColumns()
protected function setColumns()
{
$columns = $this->blueprint->columns();

$columns->push(
Column::make()
->field('taxonomy')
->fieldtype('term')
->label(__('Taxonomy'))
->listable(true)
->defaultVisibility(true)
->visible(true)
->sortable(true)
->defaultOrder($columns->count() + 1)
);

if ($key = $this->columnPreferenceKey) {
$columns->setPreferred($key);
}
Expand Down
20 changes: 20 additions & 0 deletions src/Http/Resources/CP/Taxonomies/TermsFieldtypeTerms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Statamic\Http\Resources\CP\Taxonomies;

use Illuminate\Pagination\AbstractPaginator;
use Statamic\CP\Column;
use Statamic\Fieldtypes\Terms as TermsFieldtype;

class TermsFieldtypeTerms extends Terms
Expand All @@ -29,4 +30,23 @@ protected function collectResource($resource)

return $collection;
}

protected function setColumns()
{
parent::setColumns();

$columns = $this->columns;

$type = Column::make('type')
->label(__('Taxonomy'))
->listable(true)
->defaultVisibility(true)
->visible(true)
->sortable(true)
->defaultOrder($columns->count() + 1);

$columns->put('type', $type);

$this->columns = $columns->rejectUnlisted()->values();
}
}