Merge pull request #457 from pixelfed/frontend-ui-refactor

Update AdminController, remove stats for now
This commit is contained in:
daniel 2018-09-10 21:08:08 -06:00 committed by GitHub
commit 0f673d73b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -29,7 +29,7 @@ class AdminController extends Controller
public function users(Request $request) public function users(Request $request)
{ {
$stats = $this->collectUserStats($request); $stats = [];
$users = User::orderBy('id', 'desc')->paginate(10); $users = User::orderBy('id', 'desc')->paginate(10);
return view('admin.users.home', compact('users', 'stats')); return view('admin.users.home', compact('users', 'stats'));
} }
@ -77,7 +77,7 @@ class AdminController extends Controller
protected function collectUserStats($request) protected function collectUserStats($request)
{ {
$total_duration = $request->query('total_duration') ?? '30'; $total_duration = $request->query('total_duration') ?? '30';
$new_duration = $request->query('new_duration') ?? '7'; $new_duration = $request->query('new_duration') ?? '7';
$stats = []; $stats = [];
@ -97,7 +97,7 @@ class AdminController extends Controller
'remote' => Profile::whereNotNull('remote_url')->count() 'remote' => Profile::whereNotNull('remote_url')->count()
]; ];
$stats['avg'] = [ $stats['avg'] = [
'age' => Carbon::parse(substr(User::avg('created_at'),0,8))->diffForHumans(null,true,true), 'age' => 0,
'posts' => floor(Status::avg('profile_id')) 'posts' => floor(Status::avg('profile_id'))
]; ];
return $stats; return $stats;

View file

@ -4,7 +4,8 @@
<div class="title"> <div class="title">
<h3 class="font-weight-bold">Users</h3> <h3 class="font-weight-bold">Users</h3>
</div> </div>
<div class="row mb-3"> <hr>
{{-- <div class="row mb-3">
<div class="col-12 col-md-6 mb-2"> <div class="col-12 col-md-6 mb-2">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -17,7 +18,7 @@
<option data-duration="30" selected="">1 Month</option> <option data-duration="30" selected="">1 Month</option>
<option data-duration="365">1 Year</option> <option data-duration="365">1 Year</option>
</select> </select>
</span> --}} </span>
</div> </div>
<div> <div>
<p class="h3 font-weight-bold mb-0">{{$stats['total']['count']}}</p> <p class="h3 font-weight-bold mb-0">{{$stats['total']['count']}}</p>
@ -38,7 +39,7 @@
<option selected="">1 Month</option> <option selected="">1 Month</option>
<option>1 Year</option> <option>1 Year</option>
</select> </select>
</span> --}} </span>
</div> </div>
<div> <div>
<p class="h3 font-weight-bold mb-0">{{$stats['new']['count']}}</p> <p class="h3 font-weight-bold mb-0">{{$stats['new']['count']}}</p>
@ -95,7 +96,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div> --}}
<div class="table-responsive"> <div class="table-responsive">
<table class="table"> <table class="table">
<thead class="bg-light"> <thead class="bg-light">
@ -215,8 +216,8 @@
lineColor: '#0083CD', lineColor: '#0083CD',
fillColor: false fillColor: false
}; };
$('.totalUsers').sparkline({{$stats['total']['points']}}, sparkopts); {{-- $('.totalUsers').sparkline({{$stats['total']['points']}}, sparkopts);
$('.newUsers').sparkline({{$stats['new']['points']}}, sparkopts); $('.newUsers').sparkline({{$stats['new']['points']}}, sparkopts); --}}
}); });
</script> </script>
@endpush @endpush