diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index b12b0e3ce..3d1c184cd 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -9,11 +9,10 @@ use Illuminate\Http\Request; class SettingController extends Controller { - protected $imageRepo; + protected ImageRepo $imageRepo; + + protected array $settingCategories = ['features', 'customization', 'registration']; - /** - * SettingController constructor. - */ public function __construct(ImageRepo $imageRepo) { $this->imageRepo = $imageRepo; @@ -22,15 +21,17 @@ class SettingController extends Controller /** * Display a listing of the settings. */ - public function index() + public function index(string $category) { + $this->ensureCategoryExists($category); $this->checkPermission('settings-manage'); $this->setPageTitle(trans('settings.settings')); // Get application version $version = trim(file_get_contents(base_path('version'))); - return view('settings.index', [ + return view('settings.' . $category, [ + 'category' => $category, 'version' => $version, 'guestUser' => User::getDefault(), ]); @@ -39,8 +40,9 @@ class SettingController extends Controller /** * Update the specified settings in storage. */ - public function update(Request $request) + public function update(Request $request, string $category) { + $this->ensureCategoryExists($category); $this->preventAccessInDemoMode(); $this->checkPermission('settings-manage'); $this->validate($request, [ @@ -57,7 +59,7 @@ class SettingController extends Controller } // Update logo image if set - if ($request->hasFile('app_logo')) { + if ($category === 'customization' && $request->hasFile('app_logo')) { $logoFile = $request->file('app_logo'); $this->imageRepo->destroyByType('system'); $image = $this->imageRepo->saveNew($logoFile, 'system', 0, null, 86); @@ -65,16 +67,21 @@ class SettingController extends Controller } // Clear logo image if requested - if ($request->get('app_logo_reset', null)) { + if ($category === 'customization' && $request->get('app_logo_reset', null)) { $this->imageRepo->destroyByType('system'); setting()->remove('app-logo'); } - $section = $request->get('section', ''); - $this->logActivity(ActivityType::SETTINGS_UPDATE, $section); + $this->logActivity(ActivityType::SETTINGS_UPDATE, $category); $this->showSuccessNotification(trans('settings.settings_save_success')); - $redirectLocation = '/settings#' . $section; - return redirect(rtrim($redirectLocation, '#')); + return redirect("/settings/${category}"); + } + + protected function ensureCategoryExists(string $category): void + { + if (!in_array($category, $this->settingCategories)) { + abort(404); + } } } diff --git a/resources/icons/palette.svg b/resources/icons/palette.svg new file mode 100644 index 000000000..114386302 --- /dev/null +++ b/resources/icons/palette.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/lang/en/settings.php b/resources/lang/en/settings.php index bfe99c98f..3adefc2eb 100755 --- a/resources/lang/en/settings.php +++ b/resources/lang/en/settings.php @@ -10,6 +10,8 @@ return [ 'settings' => 'Settings', 'settings_save' => 'Save Settings', 'settings_save_success' => 'Settings saved', + 'system_version' => 'System Version', + 'categories' => 'Categories', // App Settings 'app_customization' => 'Customization', diff --git a/resources/sass/_layout.scss b/resources/sass/_layout.scss index 69882d40d..b1c80cb53 100644 --- a/resources/sass/_layout.scss +++ b/resources/sass/_layout.scss @@ -8,6 +8,9 @@ margin-inline-end: auto; padding-inline-start: $-m; padding-inline-end: $-m; + &.medium { + max-width: 1100px; + } &.small { max-width: 840px; } diff --git a/resources/sass/_lists.scss b/resources/sass/_lists.scss index 8febdcffc..9cff52972 100644 --- a/resources/sass/_lists.scss +++ b/resources/sass/_lists.scss @@ -677,11 +677,21 @@ ul.pagination { padding: $-s; } a:not(.active) { - @include lightDark(color, #444, #666); + @include lightDark(color, #444, #888); } a:hover { @include lightDark(background-color, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05)); - border-radius: 3px; + border-radius: 4px; text-decoration: none; } + &.in-sidebar { + a { + display: block; + margin-bottom: $-xs; + } + a.active { + border-radius: 4px; + @include lightDark(background-color, rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05)); + } + } } diff --git a/resources/views/settings/audit.blade.php b/resources/views/settings/audit.blade.php index 48e46a59d..ca5dba527 100644 --- a/resources/views/settings/audit.blade.php +++ b/resources/views/settings/audit.blade.php @@ -3,11 +3,7 @@ @section('body')
-
-
- @include('settings.parts.navbar', ['selected' => 'audit']) -
-
+ @include('settings.parts.navbar', ['selected' => 'audit'])

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

diff --git a/resources/views/settings/customization.blade.php b/resources/views/settings/customization.blade.php new file mode 100644 index 000000000..5c6841be2 --- /dev/null +++ b/resources/views/settings/customization.blade.php @@ -0,0 +1,137 @@ +@extends('settings.layout') + +@section('card') +

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

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

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

+
+
+ + @include('form.toggle-switch', [ + 'name' => 'setting-app-name-header', + 'value' => setting('app-name-header'), + 'label' => trans('settings.app_name_header'), + ]) +
+
+ +
+
+ +

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

+
+
+ +
+
+ +
+
+ +

{!! trans('settings.app_logo_desc') !!}

+
+
+ @include('form.image-picker', [ + 'removeName' => 'setting-app-logo', + 'removeValue' => 'none', + 'defaultImage' => url('/logo.png'), + 'currentImage' => setting('app-logo'), + 'name' => 'app_logo', + 'imageClass' => 'logo-image', + ]) +
+
+ + +
+
+ +

{!! trans('settings.app_primary_color_desc') !!}

+
+
+ + +
+ + | + +
+ +
+
+ + +
+
+ +

{!! trans('settings.content_colors_desc') !!}

+
+
+
+ @include('settings.parts.setting-entity-color-picker', ['type' => 'bookshelf']) + @include('settings.parts.setting-entity-color-picker', ['type' => 'book']) + @include('settings.parts.setting-entity-color-picker', ['type' => 'chapter']) +
+
+ @include('settings.parts.setting-entity-color-picker', ['type' => 'page']) + @include('settings.parts.setting-entity-color-picker', ['type' => 'page-draft']) +
+
+
+ +
+
+ +

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

+
+
+ + + +
+
+ +
+ +

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

+ @include('settings.parts.footer-links', ['name' => 'setting-app-footer-links', 'value' => setting('app-footer-links', [])]) +
+ + +
+ +

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

+ +

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

+
+ + +
+ +
+ +
+
+@endsection + +@section('after-content') + @include('entities.selector-popup', ['entityTypes' => 'page']) +@endsection diff --git a/resources/views/settings/features.blade.php b/resources/views/settings/features.blade.php new file mode 100644 index 000000000..5935e21f5 --- /dev/null +++ b/resources/views/settings/features.blade.php @@ -0,0 +1,66 @@ +@extends('settings.layout') + +@section('card') +

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

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

{!! trans('settings.app_public_access_desc') !!}

+ @if(userCan('users-manage')) +

+ {!! trans('settings.app_public_access_desc_guest') !!} +

+ @endif +
+
+ @include('form.toggle-switch', [ + 'name' => 'setting-app-public', + 'value' => setting('app-public'), + 'label' => trans('settings.app_public_access_toggle'), + ]) +
+
+ +
+
+ +

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

+
+
+ @include('form.toggle-switch', [ + 'name' => 'setting-app-secure-images', + 'value' => setting('app-secure-images'), + 'label' => trans('settings.app_secure_images_toggle'), + ]) +
+
+ +
+
+ +

{!! trans('settings.app_disable_comments_desc') !!}

+
+
+ @include('form.toggle-switch', [ + 'name' => 'setting-app-disable-comments', + 'value' => setting('app-disable-comments'), + 'label' => trans('settings.app_disable_comments_toggle'), + ]) +
+
+ + +
+ +
+ +
+
+@endsection \ No newline at end of file diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php deleted file mode 100644 index 8b5615658..000000000 --- a/resources/views/settings/index.blade.php +++ /dev/null @@ -1,278 +0,0 @@ -@extends('layouts.simple') - -@section('body') -
- - @include('settings.parts.navbar-with-version', ['selected' => 'settings']) - -
-

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

-
- {!! csrf_field() !!} - - -
- - -
-
- -

{!! trans('settings.app_public_access_desc') !!}

- @if(userCan('users-manage')) -

- {!! trans('settings.app_public_access_desc_guest') !!} -

- @endif -
-
- @include('form.toggle-switch', [ - 'name' => 'setting-app-public', - 'value' => setting('app-public'), - 'label' => trans('settings.app_public_access_toggle'), - ]) -
-
- -
-
- -

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

-
-
- @include('form.toggle-switch', [ - 'name' => 'setting-app-secure-images', - 'value' => setting('app-secure-images'), - 'label' => trans('settings.app_secure_images_toggle'), - ]) -
-
- -
-
- -

{!! trans('settings.app_disable_comments_desc') !!}

-
-
- @include('form.toggle-switch', [ - 'name' => 'setting-app-disable-comments', - 'value' => setting('app-disable-comments'), - 'label' => trans('settings.app_disable_comments_toggle'), - ]) -
-
- - -
- -
- -
-
-
- -
-

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

-
- {!! csrf_field() !!} - - -
- -
-
- -

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

-
-
- - @include('form.toggle-switch', [ - 'name' => 'setting-app-name-header', - 'value' => setting('app-name-header'), - 'label' => trans('settings.app_name_header'), - ]) -
-
- -
-
- -

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

-
-
- -
-
- -
-
- -

{!! trans('settings.app_logo_desc') !!}

-
-
- @include('form.image-picker', [ - 'removeName' => 'setting-app-logo', - 'removeValue' => 'none', - 'defaultImage' => url('/logo.png'), - 'currentImage' => setting('app-logo'), - 'name' => 'app_logo', - 'imageClass' => 'logo-image', - ]) -
-
- - -
-
- -

{!! trans('settings.app_primary_color_desc') !!}

-
-
- - -
- - | - -
- -
-
- - -
-
- -

{!! trans('settings.content_colors_desc') !!}

-
-
-
- @include('settings.parts.setting-entity-color-picker', ['type' => 'bookshelf']) - @include('settings.parts.setting-entity-color-picker', ['type' => 'book']) - @include('settings.parts.setting-entity-color-picker', ['type' => 'chapter']) -
-
- @include('settings.parts.setting-entity-color-picker', ['type' => 'page']) - @include('settings.parts.setting-entity-color-picker', ['type' => 'page-draft']) -
-
-
- -
-
- -

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

-
-
- - - -
-
- -
- -

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

- @include('settings.parts.footer-links', ['name' => 'setting-app-footer-links', 'value' => setting('app-footer-links', [])]) -
- - -
- -

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

- -

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

-
- - -
- -
- -
-
-
- -
-

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

-
- {!! csrf_field() !!} - - -
-
-
- -

{!! trans('settings.reg_enable_desc') !!}

-
-
- @include('form.toggle-switch', [ - 'name' => 'setting-registration-enabled', - 'value' => setting('registration-enabled'), - 'label' => trans('settings.reg_enable_toggle') - ]) - - @if(in_array(config('auth.method'), ['ldap', 'saml2', 'oidc'])) -
{{ trans('settings.reg_enable_external_warning') }}
- @endif - - - -
-
- -
-
- -

{!! trans('settings.reg_confirm_restrict_domain_desc') !!}

-
-
- -
-
- -
-
- -

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

-
-
- @include('form.toggle-switch', [ - 'name' => 'setting-registration-confirmation', - 'value' => setting('registration-confirmation'), - 'label' => trans('settings.reg_email_confirmation_toggle') - ]) -
-
- -
- -
- -
-
-
- -
- - @include('entities.selector-popup', ['entityTypes' => 'page']) -@stop diff --git a/resources/views/settings/layout.blade.php b/resources/views/settings/layout.blade.php new file mode 100644 index 000000000..e2410895e --- /dev/null +++ b/resources/views/settings/layout.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.simple') + +@section('body') +
+ + @include('settings.parts.navbar', ['selected' => 'settings']) + +
+ +
+
{{ trans('settings.categories') }}
+ + +
{{ trans('settings.system_version') }}
+ +
+ +
+
+ @yield('card') +
+
+ +
+ +
+ + @yield('after-content') +@stop diff --git a/resources/views/settings/maintenance.blade.php b/resources/views/settings/maintenance.blade.php index ea94413f2..a2a9ebc81 100644 --- a/resources/views/settings/maintenance.blade.php +++ b/resources/views/settings/maintenance.blade.php @@ -3,7 +3,7 @@ @section('body')
- @include('settings.parts.navbar-with-version', ['selected' => 'maintenance']) + @include('settings.parts.navbar', ['selected' => 'maintenance'])

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

diff --git a/resources/views/settings/parts/navbar-with-version.blade.php b/resources/views/settings/parts/navbar-with-version.blade.php deleted file mode 100644 index bec41146b..000000000 --- a/resources/views/settings/parts/navbar-with-version.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -{{-- -$selected - String name of the selected tab -$version - Version of bookstack to display ---}} -
-
- @include('settings.parts.navbar', ['selected' => $selected]) -
-
-
-
-
- \ No newline at end of file diff --git a/resources/views/settings/parts/navbar.blade.php b/resources/views/settings/parts/navbar.blade.php index f2fad378c..e229f5e65 100644 --- a/resources/views/settings/parts/navbar.blade.php +++ b/resources/views/settings/parts/navbar.blade.php @@ -1,5 +1,5 @@ -