From 6847a331a70b3abd9d2a1c09ffdcf0335d1d9be8 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 24 Apr 2020 05:55:38 -0700 Subject: [PATCH] Backport the column icon fix from master Signed-off-by: snipe --- app/Presenters/UserPresenter.php | 48 +++---- resources/views/users/index.blade.php | 191 +++++++++++++++++--------- 2 files changed, 150 insertions(+), 89 deletions(-) diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 374c0022488c..da13c839c58d 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -2,7 +2,10 @@ namespace App\Presenters; -use Illuminate\Support\Facades\Storage; +use App\Helpers\Helper; +use App\Models\Setting; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Gate; /** * Class UserPresenter @@ -168,21 +171,22 @@ public static function dataTableLayout() "formatter" => "usersLinkObjFormatter" ], [ - "field" => "assets_count", - "searchable" => false, - "sortable" => true, - "switchable" => true, - "title" => ' ' - .'', - "visible" => true, + 'field' => 'assets_count', + 'searchable' => false, + 'sortable' => true, + 'switchable' => true, + 'escape' => true, + 'class' => 'css-barcode', + 'title' => 'Assets', + 'visible' => true, ], [ "field" => "licenses_count", "searchable" => false, "sortable" => true, "switchable" => true, - "title" => ' ' - .'', + 'class' => 'css-license', + "title" => 'License', "visible" => true, ], [ @@ -190,8 +194,8 @@ public static function dataTableLayout() "searchable" => false, "sortable" => true, "switchable" => true, - "title" => ' ' - .'', + 'class' => 'css-consumable', + "title" => 'Consumables', "visible" => true, ], [ @@ -199,8 +203,8 @@ public static function dataTableLayout() "searchable" => false, "sortable" => true, "switchable" => true, - "title" => ' ' - .'', + 'class' => 'css-accessory', + "title" => 'Accessories', "visible" => true, ], [ @@ -317,20 +321,16 @@ public function gravatar() { if ($this->avatar) { - return Storage::disk('public')->url('avatars/'.$this->avatar, $this->avatar); + return config('app.url').'/uploads/avatars/'.$this->avatar; } - if ($this->email != '') { - /** - * @see https://en.gravatar.com/site/implement/images/ - * Return a default [Myster Person] gravatar if the user does not have one - */ + if ((Setting::getSettings()->load_remote=='1') && ($this->email!='')) { $gravatar = md5(strtolower(trim($this->email))); - // return "//gravatar.com/avatar/".$gravatar.'?d=mp'; + return "//gravatar.com/avatar/".$gravatar; } - // Set a fun, gender-neutral default icon when there is no email - return url('/img/default-sm.png'); + // Set a fun, gender-neutral default icon + return url('/').'/img/default-sm.png'; } @@ -356,4 +356,4 @@ public function glyph() { return ''; } -} +} \ No newline at end of file diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php index 56e606b04101..4ca154a596f4 100755 --- a/resources/views/users/index.blade.php +++ b/resources/views/users/index.blade.php @@ -3,28 +3,89 @@ {{-- Page title --}} @section('title') -@if (Request::get('status')=='deleted') - {{ trans('general.deleted') }} -@else - {{ trans('general.current') }} -@endif - {{ trans('general.users') }} - -@parent + @if (request('status')=='deleted') + {{ trans('general.deleted') }} + @else + {{ trans('general.current') }} + @endif + {{ trans('general.users') }} + @parent + @stop @section('header_right') + + + @can('create', \App\Models\User::class) - @if ($snipeSettings->ldap_enabled == 1) - LDAP Sync - @endif - {{ trans('general.create') }} + @if ($snipeSettings->ldap_enabled == 1) + LDAP Sync + @endif + {{ trans('general.create') }} @endcan - @if (Request::get('status')=='deleted') - {{ trans('admin/users/table.show_current') }} + @if (request('status')=='deleted') + {{ trans('admin/users/table.show_current') }} @else - {{ trans('admin/users/table.show_deleted') }} + {{ trans('admin/users/table.show_deleted') }} @endif @can('view', \App\Models\User::class) Export @@ -34,65 +95,65 @@ {{-- Page content --}} @section('content') -
-
-
-
- {{ Form::open([ - 'method' => 'POST', - 'route' => ['users/bulkedit'], - 'class' => 'form-inline', - 'id' => 'bulkForm']) }} - - @if (Request::get('status')!='deleted') - @can('delete', \App\Models\User::class) -
- - - -
- @endcan - @endif - - - 'POST', + 'route' => ['users/bulkedit'], + 'class' => 'form-inline', + 'id' => 'bulkForm']) }} + + @if (request('status')!='deleted') + @can('delete', \App\Models\User::class) +
+ + + +
+ @endcan + @endif + + +
-
+ - {{ Form::close() }} -
-
-
-
+ {{ Form::close() }} + + + + @stop @section('moar_scripts') + @include ('partials.bootstrap-table') -@stop +@stop \ No newline at end of file