Updated settings-save action to return to the same section

This commit is contained in:
Dan Brown 2020-02-02 17:35:16 +00:00
parent 3991fbe726
commit b4f2b73590
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 8 additions and 19 deletions

View File

@ -5,8 +5,6 @@ use BookStack\Notifications\TestEmail;
use BookStack\Uploads\ImageRepo; use BookStack\Uploads\ImageRepo;
use BookStack\Uploads\ImageService; use BookStack\Uploads\ImageService;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Setting;
class SettingController extends Controller class SettingController extends Controller
{ {
@ -14,7 +12,6 @@ class SettingController extends Controller
/** /**
* SettingController constructor. * SettingController constructor.
* @param $imageRepo
*/ */
public function __construct(ImageRepo $imageRepo) public function __construct(ImageRepo $imageRepo)
{ {
@ -22,10 +19,8 @@ class SettingController extends Controller
parent::__construct(); parent::__construct();
} }
/** /**
* Display a listing of the settings. * Display a listing of the settings.
* @return Response
*/ */
public function index() public function index()
{ {
@ -43,8 +38,6 @@ class SettingController extends Controller
/** /**
* Update the specified settings in storage. * Update the specified settings in storage.
* @param Request $request
* @return Response
*/ */
public function update(Request $request) public function update(Request $request)
{ {
@ -78,12 +71,11 @@ class SettingController extends Controller
} }
$this->showSuccessNotification(trans('settings.settings_save_success')); $this->showSuccessNotification(trans('settings.settings_save_success'));
return redirect('/settings'); return redirect('/settings#' . $request->get('section', ''));
} }
/** /**
* Show the page for application maintenance. * Show the page for application maintenance.
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/ */
public function showMaintenance() public function showMaintenance()
{ {
@ -98,9 +90,6 @@ class SettingController extends Controller
/** /**
* Action to clean-up images in the system. * Action to clean-up images in the system.
* @param Request $request
* @param ImageService $imageService
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/ */
public function cleanupImages(Request $request, ImageService $imageService) public function cleanupImages(Request $request, ImageService $imageService)
{ {
@ -127,11 +116,8 @@ class SettingController extends Controller
/** /**
* Action to send a test e-mail to the current user. * Action to send a test e-mail to the current user.
* @param Request $request
* @param User $user
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/ */
public function sendTestEmail(Request $request) public function sendTestEmail()
{ {
$this->checkPermission('settings-manage'); $this->checkPermission('settings-manage');

View File

@ -15,9 +15,10 @@
</div> </div>
<div class="card content-wrap auto-height"> <div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.app_features_security') }}</h2> <h2 id="features" class="list-heading">{{ trans('settings.app_features_security') }}</h2>
<form action="{{ url("/settings") }}" method="POST"> <form action="{{ url("/settings") }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<input type="hidden" name="section" value="features">
<div class="setting-list"> <div class="setting-list">
@ -79,9 +80,10 @@
</div> </div>
<div class="card content-wrap auto-height"> <div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.app_customization') }}</h2> <h2 id="customization" class="list-heading">{{ trans('settings.app_customization') }}</h2>
<form action="{{ url("/settings") }}" method="POST" enctype="multipart/form-data"> <form action="{{ url("/settings") }}" method="POST" enctype="multipart/form-data">
{!! csrf_field() !!} {!! csrf_field() !!}
<input type="hidden" name="section" value="customization">
<div class="setting-list"> <div class="setting-list">
@ -202,9 +204,10 @@
</div> </div>
<div class="card content-wrap auto-height"> <div class="card content-wrap auto-height">
<h2 class="list-heading">{{ trans('settings.reg_settings') }}</h2> <h2 id="registration" class="list-heading">{{ trans('settings.reg_settings') }}</h2>
<form action="{{ url("/settings") }}" method="POST"> <form action="{{ url("/settings") }}" method="POST">
{!! csrf_field() !!} {!! csrf_field() !!}
<input type="hidden" name="section" value="registration">
<div class="setting-list"> <div class="setting-list">
<div class="grid half gap-xl"> <div class="grid half gap-xl">