mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-01-31 20:21:36 +01:00
Sorting: Added content misses from last commit, started settings
This commit is contained in:
parent
b2ac3e0834
commit
a34023f715
35
app/Sorting/SortSet.php
Normal file
35
app/Sorting/SortSet.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace BookStack\Sorting;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $sequence
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*/
|
||||
class SortSet extends Model
|
||||
{
|
||||
/**
|
||||
* @return SortSetOption[]
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
$strOptions = explode(',', $this->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);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sort_sets', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->text('sequence');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sort_sets');
|
||||
}
|
||||
};
|
@ -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. <br> 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',
|
||||
|
49
resources/views/settings/categories/sorting.blade.php
Normal file
49
resources/views/settings/categories/sorting.blade.php
Normal file
@ -0,0 +1,49 @@
|
||||
@extends('settings.layout')
|
||||
|
||||
@section('card')
|
||||
<h1 id="sorting" class="list-heading">{{ trans('settings.sorting') }}</h1>
|
||||
<form action="{{ url("/settings/sorting") }}" method="POST">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="section" value="sorting">
|
||||
|
||||
<div class="setting-list">
|
||||
<div class="grid half gap-xl items-center">
|
||||
<div>
|
||||
<label for="setting-sorting-book-default"
|
||||
class="setting-list-label">{{ trans('settings.sorting_book_default') }}</label>
|
||||
<p class="small">{{ trans('settings.sorting_book_default_desc') }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<select id="setting-sorting-book-default" name="setting-sorting-book-default"
|
||||
@if($errors->has('setting-sorting-book-default')) class="neg" @endif>
|
||||
<option value="0" @if(intval(setting('sorting-book-default', '0')) === 0) selected @endif>
|
||||
-- {{ trans('common.none') }} --
|
||||
</option>
|
||||
{{-- TODO--}}
|
||||
{{-- @foreach(\BookStack\Users\Models\Role::all() as $role)--}}
|
||||
{{-- <option value="{{$role->id}}"--}}
|
||||
{{-- data-system-role-name="{{ $role->system_name ?? '' }}"--}}
|
||||
{{-- @if(intval(setting('registration-role', '0')) === $role->id) selected @endif--}}
|
||||
{{-- >--}}
|
||||
{{-- {{ $role->display_name }}--}}
|
||||
{{-- </option>--}}
|
||||
{{-- @endforeach--}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="button">{{ trans('settings.settings_save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@section('after-card')
|
||||
<div class="card content-wrap auto-height">
|
||||
<h2 class="list-heading">{{ trans('settings.sorting_sets') }}</h2>
|
||||
<p class="text-muted">{{ trans('settings.sorting_sets_desc') }}</p>
|
||||
{{-- TODO--}}
|
||||
</div>
|
||||
@endsection
|
@ -13,6 +13,7 @@
|
||||
<a href="{{ url('/settings/features') }}" class="{{ $category === 'features' ? 'active' : '' }}">@icon('star') {{ trans('settings.app_features_security') }}</a>
|
||||
<a href="{{ url('/settings/customization') }}" class="{{ $category === 'customization' ? 'active' : '' }}">@icon('palette') {{ trans('settings.app_customization') }}</a>
|
||||
<a href="{{ url('/settings/registration') }}" class="{{ $category === 'registration' ? 'active' : '' }}">@icon('security') {{ trans('settings.reg_settings') }}</a>
|
||||
<a href="{{ url('/settings/sorting') }}" class="{{ $category === 'sorting' ? 'active' : '' }}">@icon('sort') {{ trans('settings.sorting') }}</a>
|
||||
</nav>
|
||||
|
||||
<h5 class="mt-xl">{{ trans('settings.system_version') }}</h5>
|
||||
@ -29,6 +30,7 @@
|
||||
<div class="card content-wrap auto-height">
|
||||
@yield('card')
|
||||
</div>
|
||||
@yield('after-card')
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user