diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 35ede27cb5..c43317fd79 100755 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -48,10 +48,9 @@ class ProfileController extends Controller $user->last_name = $request->input('last_name'); $user->website = $request->input('website'); $user->gravatar = $request->input('gravatar'); + $user->skin = $request->input('skin'); $user->phone = $request->input('phone'); - - if (!config('app.lock_passwords')) { $user->locale = $request->input('locale', 'en'); } diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index c449df4800..e2f15bca80 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -400,6 +400,7 @@ class SettingsController extends Controller $setting->version_footer = $request->input('version_footer'); $setting->footer_text = $request->input('footer_text'); $setting->skin = $request->input('skin'); + $setting->allow_user_skin = $request->input('allow_user_skin'); $setting->show_url_in_emails = $request->input('show_url_in_emails', '0'); $setting->logo_print_assets = $request->input('logo_print_assets', '0'); diff --git a/database/migrations/2019_04_06_060145_add_user_skin_setting.php b/database/migrations/2019_04_06_060145_add_user_skin_setting.php new file mode 100644 index 0000000000..efe1f94c48 --- /dev/null +++ b/database/migrations/2019_04_06_060145_add_user_skin_setting.php @@ -0,0 +1,34 @@ +string('skin')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Update the users table + Schema::table('users', function ($table) { + $table->dropColumn('skin'); + }); + } +} diff --git a/database/migrations/2019_04_06_205355_add_setting_allow_user_skin.php b/database/migrations/2019_04_06_205355_add_setting_allow_user_skin.php new file mode 100644 index 0000000000..537c1f1f4a --- /dev/null +++ b/database/migrations/2019_04_06_205355_add_setting_allow_user_skin.php @@ -0,0 +1,34 @@ +boolean('allow_user_skin')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // Update the users table + Schema::table('settings', function ($table) { + $table->dropColumn('allow_user_skin'); + }); + } +} \ No newline at end of file diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.php index 547ffc7695..37a2d93e7d 100644 --- a/resources/lang/en/admin/settings/general.php +++ b/resources/lang/en/admin/settings/general.php @@ -14,6 +14,8 @@ return array( 'alerts_enabled' => 'Email Alerts Enabled', 'alert_interval' => 'Expiring Alerts Threshold (in days)', 'alert_inv_threshold' => 'Inventory Alert Threshold', + 'allow_user_skin' => 'Allow user skin', + 'allow_user_skin_help_text' => 'Checking this box will allow a user to change the site skin for himself.' , 'asset_ids' => 'Asset IDs', 'audit_interval' => 'Audit Interval', 'audit_interval_help' => 'If you are required to regularly physically audit your assets, enter the interval in months.', diff --git a/resources/macros/macros.php b/resources/macros/macros.php index 0cca0864c1..f022aaf046 100644 --- a/resources/macros/macros.php +++ b/resources/macros/macros.php @@ -582,3 +582,34 @@ Form::macro('skin', function ($name = "skin", $selected = null, $class = null) { return $select; }); + +Form::macro('user_skin', function ($name = "skin", $selected = null, $class = null) { + + $formats = array( + '' => 'Site Default', + 'blue' => 'Default Blue', + 'blue-dark' => 'Blue (Dark Mode)', + 'green' => 'Green Dark', + 'green-dark' => 'Green (Dark Mode)', + 'red' => 'Red Dark', + 'red-dark' => 'Red (Dark Mode)', + 'orange' => 'Orange Dark', + 'orange-dark' => 'Orange (Dark Mode)', + 'black' => 'Black', + 'black-dark' => 'Black (Dark Mode)', + 'purple' => 'Purple', + 'purple-dark' => 'Purple (Dark Mode)', + 'yellow' => 'Yellow', + 'yellow-dark' => 'Yellow (Dark Mode)', + 'contrast' => 'High Contrast', + ); + + $select = ''; + return $select; + +}); \ No newline at end of file diff --git a/resources/views/account/profile.blade.php b/resources/views/account/profile.blade.php index 37230bf0b3..74d085362b 100755 --- a/resources/views/account/profile.blade.php +++ b/resources/views/account/profile.blade.php @@ -58,6 +58,17 @@ + @if ($snipeSettings->allow_user_skin=='1') + +
{{ trans('admin/settings/general.allow_user_skin_help_text') }}
+