A free open source IT asset/license management system
Add a way for a user to override the site skin setting + fix mislabeled comment. (#6891)
NMC3e934a1b96e7
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.phpindex 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.phpindex 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.phpnew file mode 100644index 0000000000..efe1f94c48--- /dev/null+++ b/database/migrations/2019_04_06_060145_add_user_skin_setting.php@@ -0,0 +1,34 @@+<?php++use Illuminate\Support\Facades\Schema;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Database\Migrations\Migration;++class AddUserSkinSetting extends Migration+{+ /**+ * Run the migrations.+ *+ * @return void+ */+ public function up()+ {+ // Update the users table+ Schema::table('users', function ($table) {+ $table->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.phpnew file mode 100644index 0000000000..537c1f1f4a--- /dev/null+++ b/database/migrations/2019_04_06_205355_add_setting_allow_user_skin.php@@ -0,0 +1,34 @@+<?php++use Illuminate\Support\Facades\Schema;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Database\Migrations\Migration;++class AddSettingAllowUserSkin extends Migration+{+ /**+ * Run the migrations.+ *+ * @return void+ */+ public function up()+ {+ // Update the users table+ Schema::table('settings', function ($table) {+ $table->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 filediff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.phpindex 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.phpindex 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 = '<select name="'.$name.'" class="'.$class.'" style="width: 250px">';+ foreach ($formats as $format => $label) {+ $select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected"' : '').'>'.$label.'</option> '."\n";+ }++ $select .= '</select>';+ return $select;++});\ No newline at end of filediff --git a/resources/views/account/profile.blade.php b/resources/views/account/profile.blade.phpindex 37230bf0b3..74d085362b 100755--- a/resources/views/account/profile.blade.php+++ b/resources/views/account/profile.blade.php@@ -58,6 +58,17 @@</div></div>+ @if ($snipeSettings->allow_user_skin=='1')+ <!-- Skin -->+ <div class="form-group {{ $errors->has('skin') ? 'error' : '' }}">+ <label for="website" class="col-md-3 control-label">{{ Form::label('skin', trans('general.skin')) }}</label>+ <div class="col-md-8">+ {!! Form::user_skin('skin', Input::old('skin', $user->skin), 'select2') !!}+ {!! $errors->first('skin', '<span class="alert-msg">:message</span>') !!}+ </div>+ </div>+ @endif+<!-- Phone --><div class="form-group {{ $errors->has('phone') ? 'has-error' : '' }}"><label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.phone') }}</label>@@ -67,8 +78,6 @@</div></div>--<!-- Website URL --><div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}"><label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label>@@ -114,8 +123,6 @@--<!-- Two factor opt in -->@if ($snipeSettings->two_factor_enabled=='1')<div class="form-group {{ $errors->has('avatar') ? 'has-error' : '' }}">diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.phpindex 77788b207c..7d12de4c76 100644--- a/resources/views/layouts/default.blade.php+++ b/resources/views/layouts/default.blade.php@@ -28,13 +28,13 @@</script>{{-- stylesheets --}}-- <link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">+ <link rel="stylesheet" href="{{ mix('css/all.css') }}">+ @if (($snipeSettings) && ($snipeSettings->allow_user_skin==1) && Auth::check() && Auth::user()->present()->skin != '')+ <link rel="stylesheet" href="{{ mix('css/skins/skin-'.Auth::user()->present()->skin.'.min.css') }}">+ @elseif (($snipeSettings) && ($snipeSettings->skin!=''))<link rel="stylesheet" href="{{ url(mix('css/dist/skins/skin-'.($snipeSettings->skin!='' ? $snipeSettings->skin : 'blue').'.css')) }}">---- {{-- page level css --}}+ @endif+ {{-- page level css --}}@stack('css')diff --git a/resources/views/settings/branding.blade.php b/resources/views/settings/branding.blade.phpindex 5081d25fc3..92c503cf21 100644--- a/resources/views/settings/branding.blade.php+++ b/resources/views/settings/branding.blade.php@@ -150,7 +150,7 @@</div></div>- <!-- Email format -->+ <!-- Skin --><div class="form-group {{ $errors->has('skin') ? 'error' : '' }}"><div class="col-md-3">{{ Form::label('skin', trans('general.skin')) }}@@ -161,6 +161,17 @@</div></div>+ <!-- Allow User Skin -->+ <div class="form-group">+ <div class="col-md-3">+ {{ Form::label('allow_user_skin', trans('admin/settings/general.allow_user_skin')) }}+ </div>+ <div class="col-md-9">+ {{ Form::checkbox('allow_user_skin', '1', Input::old('allow_user_skin', $setting->allow_user_skin),array('class' => 'minimal')) }}+ {{ trans('general.yes') }}+ <p class="help-block">{{ trans('admin/settings/general.allow_user_skin_help_text') }}</p>+ </div>+ </div><!-- Custom css --><div class="form-group {{ $errors->has('custom_css') ? 'error' : '' }}">