Skip to content

Commit ab6225b

Browse files
64knlkeeama13
andauthored
feat: Version 0.15.2 (#192)
* feat: component filter added (#176) * fix: only add column when it doesn't exist (#167) * fix: only add column when it doesn't exist * style: formatting * feat: export cms (#169) * feat: import export * feat: use file instead of database * feat: move import/export to model * fix: export from tableitem * feat: move export to Trait * style: formatting * style: formatting * fix: never use file as source of truth * style: formatting * chore: cleanup * fix: use export to file * feat: comment things that no longer work * feat: add meta data * feat: list filenames * feat: cleaner export * feat: remove UI for import/export * style: formatting * feat: add import command * feat: import from files * feat: remove import UI * feat: prevent editing tables with changes on disk * feat: do not use id's in export for tables * feat: optionally export ids * feat: import ids when available --------- Co-authored-by: Rene <[email protected]> * feat: component filter added * feat: added filterparams * feat: only query if filter exists * feat: WIP * feat: typed editor classes * feat: editor changes * feat: removed code * feat: removed request from editor and overview * feat: added TODO * chore: update dependency * feat: migration for model column in cms_table * fix: retain model on import export cms_table * feat: moved code to component * feat: added guards * style: formatting * feat: parameters now in tableservice * feat: removed parameter * feat: removed request() from editor * fix: return empty array if key not exists * style: formatting * style: formatting --------- Co-authored-by: René <[email protected]> * fix: exceptions handling (#189) * fix: exception handling * style: formatting * fix: return type * feat: date helper (#191) * feat: moved layoutbar to editor (#193) * feat: moved layoutbar to editor * style: formatting * chore: remove unused methods --------- Co-authored-by: Rene <[email protected]> --------- Co-authored-by: Xander Schuurman <[email protected]>
1 parent 166ae92 commit ab6225b

File tree

2 files changed

+26
-38
lines changed

2 files changed

+26
-38
lines changed

src/Http/Controllers/Assets/TableOverviewController.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use NotFound\Framework\Services\Assets\TableQueryService;
1111
use NotFound\Framework\Services\Assets\TableService;
1212
use NotFound\Layout\Elements\LayoutBar;
13-
use NotFound\Layout\Elements\LayoutBarButton;
1413
use NotFound\Layout\Elements\LayoutPage;
1514
use NotFound\Layout\Elements\LayoutPager;
1615
use NotFound\Layout\Elements\LayoutSearchBox;
@@ -76,22 +75,8 @@ public function index(Request $request, Table $table)
7675

7776
$page->addBreadCrumb($editor->getBreadCrumbs());
7877

79-
$bar = new LayoutBar();
80-
$bottomBar = new LayoutBar();
81-
$bottomBar->noBackground();
82-
83-
if ($table->allow_create) {
84-
$addNew = new LayoutBarButton('Nieuw');
85-
$addNew->setIcon('plus');
86-
$url = '/table/'.$table->url.'/0';
87-
if ($params = $editor->filterToParams());
88-
89-
$url .= '?'.ltrim($params, '&');
90-
91-
$addNew->setLink($url);
92-
$bar->addBarButton($addNew);
93-
$bottomBar->addBarButton($addNew);
94-
}
78+
$bar = $editor->getBar();
79+
$bottomBar = $editor->getBottomBar();
9580

9681
$pager = new LayoutPager(totalItems: $siteTableRowsPaginator->total(), itemsPerPage: request()->query('pitems') ?? $table->properties->itemsPerPage ?? 25);
9782
$bar->addPager($pager);

src/Models/Editor/AbstractEditor.php

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace NotFound\Framework\Models\Editor;
44

55
use NotFound\Framework\Services\Assets\TableService;
6+
use NotFound\Layout\Elements\LayoutBar;
7+
use NotFound\Layout\Elements\LayoutBarButton;
68
use NotFound\Layout\Elements\LayoutBreadcrumb;
79

810
abstract class AbstractEditor
@@ -12,39 +14,40 @@ public function __construct(protected TableService $ts)
1214

1315
}
1416

15-
/**
16-
* preOverview
17-
*
18-
* Runs before the overview is rendered
19-
*/
20-
public function preOverview(): void
17+
public function getBar(): LayoutBar
2118
{
19+
$bar = new LayoutBar();
2220

23-
}
24-
25-
public function postOverview(): void
26-
{
27-
28-
}
29-
30-
public function preEdit(): void
31-
{
32-
33-
}
21+
$table = $this->ts->getAssetModel();
3422

35-
public function postEdit(): void
36-
{
23+
if ($table->allow_create) {
24+
$addNew = $this->getNewButton();
25+
$bar->addBarButton($addNew);
26+
}
3727

28+
return $bar;
3829
}
3930

40-
public function preCreate(): void
31+
public function getBottomBar(): LayoutBar
4132
{
33+
$bottomBar = $this->getBar();
34+
$bottomBar->noBackground();
4235

36+
return $bottomBar;
4337
}
4438

45-
public function postCreate(): void
39+
public function getNewButton(): LayoutBarButton
4640
{
41+
$addNew = new LayoutBarButton('Nieuw');
42+
$table = $this->ts->getAssetModel();
43+
$addNew->setIcon('plus');
44+
$url = '/table/'.$table->url.'/0';
45+
if ($params = $this->filterToParams()) {
46+
$url .= '?'.ltrim($params, '&');
47+
}
48+
$addNew->setLink($url);
4749

50+
return $addNew;
4851
}
4952

5053
public function getBreadCrumbs(): LayoutBreadCrumb

0 commit comments

Comments
 (0)