From 0cffb0c934499cb7112e6e47a3013c890ef37142 Mon Sep 17 00:00:00 2001 From: Sam Georges Date: Wed, 10 Sep 2014 18:44:25 +1000 Subject: [PATCH] Add Save & Close button to settings pages --- CHANGELOG.md | 3 +++ modules/system/controllers/Settings.php | 14 ++++++++++---- modules/system/controllers/settings/update.htm | 11 ++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8378607d..5b86fba5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +* **Build 14x** (2014-09-xx) + - Standard setting pages now have **Save** and **Save and Close** buttons. + * **Build 143** (2014-09-09) - Various fixes to the RelationController relating to belongsToMany relations. - Tree Lists are now collapsed by default to better handle large data sets. diff --git a/modules/system/controllers/Settings.php b/modules/system/controllers/Settings.php index af03d20c7..c689cf3da 100644 --- a/modules/system/controllers/Settings.php +++ b/modules/system/controllers/Settings.php @@ -94,10 +94,16 @@ class Settings extends Controller Flash::success(Lang::get('system::lang.settings.update_success', ['name' => Lang::get($item->label)])); - if ($item->context == 'mysettings') - return Redirect::to(Backend::url('system/settings/mysettings')); - else - return Redirect::to(Backend::url('system/settings')); + /* + * Handle redirect + */ + if ($redirectUrl = post('redirect', true)) { + $redirectUrl = ($item->context == 'mysettings') + ? Backend::url('system/settings/mysettings') + : Backend::url('system/settings'); + + return Redirect::to($redirectUrl); + } } /** diff --git a/modules/system/controllers/settings/update.htm b/modules/system/controllers/settings/update.htm index 9f46bd05a..a7198ba4a 100644 --- a/modules/system/controllers/settings/update.htm +++ b/modules/system/controllers/settings/update.htm @@ -16,7 +16,16 @@ class="btn btn-primary"> - +