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')