From a34023f715575dcf64f0c023cea81af9aa1364e8 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 30 Jan 2025 17:49:19 +0000 Subject: [PATCH] Sorting: Added content misses from last commit, started settings --- app/Sorting/SortSet.php | 35 +++++++++++++ ...25_01_29_180933_create_sort_sets_table.php | 29 +++++++++++ lang/en/settings.php | 7 +++ .../settings/categories/sorting.blade.php | 49 +++++++++++++++++++ resources/views/settings/layout.blade.php | 2 + 5 files changed, 122 insertions(+) create mode 100644 app/Sorting/SortSet.php create mode 100644 database/migrations/2025_01_29_180933_create_sort_sets_table.php create mode 100644 resources/views/settings/categories/sorting.blade.php diff --git a/app/Sorting/SortSet.php b/app/Sorting/SortSet.php new file mode 100644 index 000000000..42e1e0951 --- /dev/null +++ b/app/Sorting/SortSet.php @@ -0,0 +1,35 @@ +sequence); + $options = array_map(fn ($val) => SortSetOption::tryFrom($val), $strOptions); + return array_filter($options); + } + + /** + * @param SortSetOption[] $options + */ + public function setOptions(array $options): void + { + $values = array_map(fn (SortSetOption $opt) => $opt->value, $options); + $this->sequence = implode(',', $values); + } +} diff --git a/database/migrations/2025_01_29_180933_create_sort_sets_table.php b/database/migrations/2025_01_29_180933_create_sort_sets_table.php new file mode 100644 index 000000000..bf9780c5b --- /dev/null +++ b/database/migrations/2025_01_29_180933_create_sort_sets_table.php @@ -0,0 +1,29 @@ +increments('id'); + $table->string('name'); + $table->text('sequence'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sort_sets'); + } +}; diff --git a/lang/en/settings.php b/lang/en/settings.php index c0b6b692a..b20152bfe 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -74,6 +74,13 @@ return [ 'reg_confirm_restrict_domain_desc' => 'Enter a comma separated list of email domains you would like to restrict registration to. Users will be sent an email to confirm their address before being allowed to interact with the application.
Note that users will be able to change their email addresses after successful registration.', 'reg_confirm_restrict_domain_placeholder' => 'No restriction set', + // Sorting Settings + 'sorting' => 'Sorting', + 'sorting_book_default' => 'Default Book Sort', + 'sorting_book_default_desc' => 'Select the default sort set to apply to new books. This won\'t affect existing books, and can be overridden per-book.', + 'sorting_sets' => 'Sort Sets', + 'sorting_sets_desc' => 'These are predefined sorting operations which can be applied to content in the system.', + // Maintenance settings 'maint' => 'Maintenance', 'maint_image_cleanup' => 'Cleanup Images', diff --git a/resources/views/settings/categories/sorting.blade.php b/resources/views/settings/categories/sorting.blade.php new file mode 100644 index 000000000..153ea0e3b --- /dev/null +++ b/resources/views/settings/categories/sorting.blade.php @@ -0,0 +1,49 @@ +@extends('settings.layout') + +@section('card') +

{{ trans('settings.sorting') }}

+
+ {{ csrf_field() }} + + +
+
+
+ +

{{ trans('settings.sorting_book_default_desc') }}

+
+
+ +
+
+ +
+ +
+ +
+
+@endsection + +@section('after-card') +
+

{{ trans('settings.sorting_sets') }}

+

{{ trans('settings.sorting_sets_desc') }}

+{{-- TODO--}} +
+@endsection \ No newline at end of file diff --git a/resources/views/settings/layout.blade.php b/resources/views/settings/layout.blade.php index a59b58d53..930d407a5 100644 --- a/resources/views/settings/layout.blade.php +++ b/resources/views/settings/layout.blade.php @@ -13,6 +13,7 @@ @icon('star') {{ trans('settings.app_features_security') }} @icon('palette') {{ trans('settings.app_customization') }} @icon('security') {{ trans('settings.reg_settings') }} + @icon('sort') {{ trans('settings.sorting') }}
{{ trans('settings.system_version') }}
@@ -29,6 +30,7 @@
@yield('card')
+ @yield('after-card')