Skip to content

Commit

Permalink
Artwork [WEB-2982]
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgarwood committed Jan 21, 2025
1 parent fd5e715 commit 798a523
Showing 1 changed file with 32 additions and 47 deletions.
79 changes: 32 additions & 47 deletions app/Http/Controllers/Twill/ArtworkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,11 @@

namespace App\Http\Controllers\Twill;

class ArtworkController extends \App\Http\Controllers\Twill\BaseApiController
{
protected $moduleName = 'artworks';
protected $hasAugmentedModel = true;

protected $indexOptions = [
'publish' => false,
'bulkPublish' => false,
'feature' => false,
'bulkFeature' => false,
'restore' => false,
'bulkRestore' => false,
'bulkDelete' => false,
'reorder' => false,
'permalink' => true,
];

protected $indexColumns = [
'image' => [
'thumb' => true,
'present' => true,
'presenter' => 'imageThumb',
'variant' => [
'role' => 'hero',
'crop' => 'default',
],
],
'fullTitle' => [
'title' => 'Title',
'field' => 'fullTitle',
],
'main_reference_number' => [
'title' => 'Reference number',
'field' => 'main_reference_number',
],
'augmented' => [
'title' => 'Augmented?',
'field' => 'augmented',
'present' => true,
],
'artist_display' => [
'title' => 'Artist',
'field' => 'artist_display',
],
];

protected $titleColumnKey = 'fullTitle';
use A17\Twill\Services\Listings\Columns\Text;
use A17\Twill\Services\Listings\TableColumns;

class ArtworkController extends BaseApiController
{
protected $browserColumns = [
'fullTitle' => [
'title' => 'Title',
Expand All @@ -62,6 +19,34 @@ class ArtworkController extends \App\Http\Controllers\Twill\BaseApiController
*/
protected $formWith = [];

public function setUpController(): void
{
parent::setUpController();
$this->enableAugmentedModel();
$this->enableShowImage();
$this->setTitleColumnKey('fullTitle');
$this->setModuleName('artworks');
}

protected function additionalIndexTableColumns(): TableColumns
{
$columns = TableColumns::make();
$columns->add(
Text::make()
->title('Reference number')
->field('main_reference_number')
->optional()
);
$columns->add(
Text::make()
->title('Artist')
->field('artist_display')
->optional()
);
return $columns;
}


protected function indexData($request)
{
return [];
Expand Down

0 comments on commit 798a523

Please sign in to comment.