Skip to content

Commit

Permalink
Merge pull request #848 from owlchester/refactor/explore-grid-switch
Browse files Browse the repository at this point in the history
Merge tree, grid, nested and flat views into a single url
  • Loading branch information
ilestis authored Apr 9, 2024
2 parents 2315127 + fa53a79 commit 56cb41f
Show file tree
Hide file tree
Showing 145 changed files with 307 additions and 574 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/Api/v1/FullTextSearchApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ public function index(Campaign $campaign)
{
$this->authorize('access', $campaign);
$term = request()->term;
$term2 = null;
/** @var Entity|null $entity */
$entity = Entity::where(['name' => request()->term, 'campaign_id' => $campaign->id])->first();
if ($entity) {
// @phpstan-ignore-next-line
$term2 = $entity->type() . ':' . $entity->id;
}

Expand Down
10 changes: 1 addition & 9 deletions app/Http/Controllers/Crud/AbilityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,14 @@
use App\Http\Requests\StoreAbility;
use App\Models\Ability;
use App\Models\Campaign;
use App\Traits\TreeControllerTrait;

class AbilityController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'abilities';
protected string $route = 'abilities';
protected string $module = 'abilities';

/**
* Crud models
*/
protected $model = Ability::class;
protected string $model = Ability::class;

protected string $filter = AbilityFilter::class;

Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Crud/AttributeTemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ class AttributeTemplateController extends CrudController
protected string $route = 'attribute_templates';
protected string $module = 'entity_attributes';

protected $model = AttributeTemplate::class;
protected string $model = AttributeTemplate::class;

protected string $filter = AttributeTemplateFilter::class;

protected string $forceMode = 'table';

protected function getNavActions(): CrudController
{
$this->addNavAction(
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Crud/BookmarkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class BookmarkController extends CrudController
protected bool $tabCopy = false;
protected bool $hasLimitCheck = true;

/** @var string */
protected $model = Bookmark::class;
protected string $model = Bookmark::class;

/** */
protected string $datagridActions = BookmarkDatagridActions::class;
Expand Down
12 changes: 2 additions & 10 deletions app/Http/Controllers/Crud/CalendarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@
use App\Models\Calendar;
use App\Models\Campaign;
use App\Sanitizers\CalendarSanitizer;
use App\Traits\TreeControllerTrait;

class CalendarController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'calendars';
protected string $route = 'calendars';
protected $module = 'calendars';

protected string $module = 'calendars';

/** @var string */
protected $model = Calendar::class;
protected string $model = Calendar::class;

/** */
protected string $filter = CalendarFilter::class;

protected string $sanitizer = CalendarSanitizer::class;
Expand Down
19 changes: 2 additions & 17 deletions app/Http/Controllers/Crud/CharacterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,34 @@

class CharacterController extends CrudController
{
/**
*/
protected string $view = 'characters';
protected string $route = 'characters';
protected $module = 'characters';
protected string $module = 'characters';

/**
* @var string
*/
protected $model = Character::class;
protected string $model = Character::class;

/**
*/
protected string $filter = CharacterFilter::class;

public function store(StoreCharacter $request, Campaign $campaign)
{
return $this->campaign($campaign)->crudStore($request);
}

/**
*/
public function show(Campaign $campaign, Character $character)
{
return $this->campaign($campaign)->crudShow($character);
}

/**
*/
public function edit(Campaign $campaign, Character $character)
{
return $this->campaign($campaign)->crudEdit($character);
}

/**
*/
public function update(StoreCharacter $request, Campaign $campaign, Character $character)
{
return $this->campaign($campaign)->crudUpdate($request, $character);
}

/**
*/
public function destroy(Campaign $campaign, Character $character)
{
return $this->campaign($campaign)->crudDestroy($character);
Expand Down
9 changes: 2 additions & 7 deletions app/Http/Controllers/Crud/ConversationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@

class ConversationController extends CrudController
{
/**
*/
protected string $view = 'conversations';
protected string $route = 'conversations';
protected $module = 'conversations';
protected string $module = 'conversations';

/** @var string Model */
protected $model = Conversation::class;
protected string $model = Conversation::class;

/** @var string Filter */
protected string $filter = ConversationFilter::class;

/** */
protected string $datagridActions = DeprecatedDatagridActions::class;

protected string $forceMode = 'table';
Expand Down
11 changes: 2 additions & 9 deletions app/Http/Controllers/Crud/CreatureController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
use App\Http\Requests\StoreCreature;
use App\Models\Campaign;
use App\Models\Creature;
use App\Traits\TreeControllerTrait;

class CreatureController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'creatures';
protected string $route = 'creatures';
protected $module = 'creatures';
protected string $module = 'creatures';

/** @var string Model */
protected $model = Creature::class;
protected string $model = Creature::class;

/** @var string Filter */
protected string $filter = CreatureFilter::class;

/**
Expand Down
9 changes: 2 additions & 7 deletions app/Http/Controllers/Crud/DiceRollController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@

class DiceRollController extends CrudController
{
/**
*/
protected string $view = 'dice_rolls';
protected string $route = 'dice_rolls';
protected $module = 'dice_rolls';
protected string $module = 'dice_rolls';

/** @var string Model */
protected $model = DiceRoll::class;
protected string $model = DiceRoll::class;

/** @var string Filter */
protected string $filter = DiceRollFilter::class;

/** */
protected string $datagridActions = DeprecatedDatagridActions::class;

protected string $forceMode = 'table';
Expand Down
6 changes: 1 addition & 5 deletions app/Http/Controllers/Crud/DiceRollResultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@

class DiceRollResultController extends CrudController
{
/**
*/
protected string $view = 'dice_roll_results';
protected string $route = 'dice_roll_results';

/** @var string Model */
protected $model = DiceRollResult::class;
protected string $model = DiceRollResult::class;

/** @var string Filter */
protected string $filter = DiceRollResult::class;

protected string $forceMode = 'table';
Expand Down
11 changes: 2 additions & 9 deletions app/Http/Controllers/Crud/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
use App\Http\Requests\StoreEvent;
use App\Models\Campaign;
use App\Models\Event;
use App\Traits\TreeControllerTrait;

class EventController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'events';
protected string $route = 'events';
protected $module = 'events';
protected string $module = 'events';

/** @var string Model */
protected $model = Event::class;
protected string $model = Event::class;

/** @var string Filter */
protected string $filter = EventFilter::class;

public function store(StoreEvent $request, Campaign $campaign)
Expand Down
13 changes: 2 additions & 11 deletions app/Http/Controllers/Crud/FamilyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@
use App\Http\Requests\StoreFamily;
use App\Models\Campaign;
use App\Models\Family;
use App\Traits\TreeControllerTrait;

class FamilyController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'families';
protected string $route = 'families';
protected $module = 'families';
protected string $module = 'families';

/**
* Crud models
*/
protected $model = Family::class;
protected string $model = Family::class;

/** @var string Filter */
protected string $filter = FamilyFilter::class;

public function store(StoreFamily $request, Campaign $campaign)
Expand Down
11 changes: 2 additions & 9 deletions app/Http/Controllers/Crud/ItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
use App\Http\Requests\StoreItem;
use App\Models\Campaign;
use App\Models\Item;
use App\Traits\TreeControllerTrait;

class ItemController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'items';
protected string $route = 'items';
protected $module = 'items';
protected string $module = 'items';

/** @var string Model */
protected $model = Item::class;
protected string $model = Item::class;

/** @var string Filter */
protected string $filter = ItemFilter::class;

/**
Expand Down
14 changes: 2 additions & 12 deletions app/Http/Controllers/Crud/JournalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,15 @@
use App\Http\Requests\StoreJournal;
use App\Models\Campaign;
use App\Models\Journal;
use App\Traits\TreeControllerTrait;

class JournalController extends CrudController
{
/**
* Tree / Nested Mode
*/
use TreeControllerTrait;

/**
*/
protected string $view = 'journals';
protected string $route = 'journals';
protected $module = 'journals';
protected string $module = 'journals';

/** @var string Model*/
protected $model = Journal::class;
protected string $model = Journal::class;

/** @var string Filter */
protected string $filter = JournalFilter::class;

/**
Expand Down
11 changes: 2 additions & 9 deletions app/Http/Controllers/Crud/LocationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,15 @@
use App\Http\Requests\StoreLocation;
use App\Models\Campaign;
use App\Models\Location;
use App\Traits\TreeControllerTrait;

class LocationController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'locations';
protected string $route = 'locations';
protected $module = 'locations';
protected string $module = 'locations';

/** @var string Model */
protected $model = Location::class;
protected string $model = Location::class;

/** @var string Filter */
protected string $filter = LocationFilter::class;

/**
Expand Down
13 changes: 2 additions & 11 deletions app/Http/Controllers/Crud/MapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,15 @@
use App\Http\Requests\StoreMap;
use App\Models\Campaign;
use App\Models\Map;
use App\Traits\TreeControllerTrait;

class MapController extends CrudController
{
use TreeControllerTrait;

/**
*/
protected string $view = 'maps';
protected string $route = 'maps';
protected $module = 'maps';
protected string $module = 'maps';

/**
* Crud models
*/
protected $model = Map::class;
protected string $model = Map::class;

/** @var string Filter */
protected string $filter = MapFilter::class;


Expand Down
Loading

0 comments on commit 56cb41f

Please sign in to comment.