1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Default templates: Added page picker and working forms

- Adapted existing page picker to be usable elsewhere.
- Added endpoint for getting templates for entity picker.
- Added search template filter to support above.
- Updated book save handling to check/validate submitted template.
  - Allows non-visible pages to flow through the save process, if not
    being changed.
- Updated page deletes to handle removal of default usage on books.
- Tweaked wording and form styles to suit.
- Updated migration to explicity reflect default value.
This commit is contained in:
Dan Brown
2023-12-11 15:55:43 +00:00
parent d61f42a377
commit 7ebe7d4e58
19 changed files with 121 additions and 41 deletions

View File

@ -58,7 +58,7 @@ class SearchRunner
$entityTypesToSearch = $entityTypes;
if ($entityType !== 'all') {
$entityTypesToSearch = $entityType;
$entityTypesToSearch = [$entityType];
} elseif (isset($searchOpts->filters['type'])) {
$entityTypesToSearch = explode('|', $searchOpts->filters['type']);
}
@ -469,6 +469,13 @@ class SearchRunner
});
}
protected function filterIsTemplate(EloquentBuilder $query, Entity $model, $input)
{
if ($model instanceof Page) {
$query->where('template', '=', true);
}
}
protected function filterSortBy(EloquentBuilder $query, Entity $model, $input)
{
$functionName = Str::camel('sort_by_' . $input);