mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Add a way for a user to override the site skin setting + fix mislabeled comment. (#6891)
* Add a way for a user to override the skin setting. * Add site setting to allow user to change the skin. * Fix skin list. Co-authored-by: NMC <info@nmc-lab.com>
This commit is contained in:
parent
78cc47a859
commit
3e934a1b96
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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.',
|
||||
|
|
|
@ -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;
|
||||
|
||||
});
|
|
@ -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' : '' }}">
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
||||
|
|
|
@ -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' : '' }}">
|
||||
|
|
Loading…
Reference in a new issue