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

Frontend ui refactor
This commit is contained in:
daniel 2018-08-31 20:29:42 -06:00 committed by GitHub
commit 7ddd1fad4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 59 additions and 19 deletions

View file

@ -3,12 +3,18 @@
namespace App\Http\Controllers;
use App\Media;
use App\Report;
use App\Status;
use App\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Admin\{
AdminReportController
};
class AdminController extends Controller
{
use AdminReportController;
public function __construct()
{
return $this->middleware('admin');
@ -46,4 +52,16 @@ class AdminController extends Controller
return view('admin.media.home', compact('media'));
}
public function reports(Request $request)
{
$reports = Report::orderBy('created_at','desc')->paginate(12);
return view('admin.reports.home', compact('reports'));
}
public function showReport(Request $request, $id)
{
$report = Report::findOrFail($id);
return view('admin.reports.show', compact('report'));
}
}

View file

@ -57,8 +57,14 @@ class BaseApiController extends Controller
public function accountStatuses(Request $request, $id)
{
$pid = Auth::user()->profile->id;
$profile = Profile::findOrFail($id);
$statuses = $profile->statuses()->orderBy('id', 'desc')->paginate(20);
$statuses = $profile->statuses();
if($pid === $profile->id) {
$statuses = $statuses->orderBy('id', 'desc')->paginate(20);
} else {
$statuses = $statuses->whereVisibility('public')->orderBy('id', 'desc')->paginate(20);
}
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();

View file

@ -42,6 +42,7 @@ class SiteController extends Controller
$timeline = Status::whereIn('profile_id', $following)
->whereNotIn('profile_id', $filtered)
->whereHas('media')
->whereVisibility('public')
->orderBy('id', 'desc')
->withCount(['comments', 'likes', 'shares'])
->simplePaginate(20);

View file

@ -52,6 +52,7 @@ class TimelineController extends Controller
->whereNotIn('profile_id', $filtered)
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id')
->whereVisibility('public')
->withCount(['comments', 'likes'])
->orderBy('id', 'desc')
->simplePaginate(20);

View file

@ -2,13 +2,14 @@
namespace App;
use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable, SoftDeletes;
use Notifiable, SoftDeletes, HasApiTokens;
/**
* The attributes that should be mutated to dates.

View file

@ -1,37 +1,37 @@
<div class="col-12 col-md-3 py-3" style="border-right:1px solid #ccc;">
<ul class="nav flex-column settings-nav">
<li class="nav-item pl-3 {{request()->is('dashboard')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.home')}}">Dashboard</a>
<a class="nav-link font-weight-bold text-muted" href="{{route('admin.home')}}">Dashboard</a>
</li>
<li class="nav-item pl-3 {{request()->is('alerts*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Alerts</a>
<a class="nav-link font-weight-bold text-muted" href="#">Alerts</a>
</li>
<li class="nav-item">
<hr>
</li>
<li class="nav-item pl-3 {{request()->is('instances*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Instances</a>
<a class="nav-link font-weight-bold text-muted" href="#">Instances</a>
</li>
<li class="nav-item pl-3 {{request()->is('media*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.media')}}">Media</a>
<a class="nav-link font-weight-bold text-muted" href="{{route('admin.media')}}">Media</a>
</li>
<li class="nav-item pl-3 {{request()->is('reports*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Reports</a>
<a class="nav-link font-weight-bold text-muted" href="{{route('admin.reports')}}">Reports</a>
</li>
<li class="nav-item pl-3 {{request()->is('statuses*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.statuses')}}">Statuses</a>
<a class="nav-link font-weight-bold text-muted" href="{{route('admin.statuses')}}">Statuses</a>
</li>
<li class="nav-item pl-3 {{request()->is('users*')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('admin.users')}}">Users</a>
<a class="nav-link font-weight-bold text-muted" href="{{route('admin.users')}}">Users</a>
</li>
<li class="nav-item">
<hr>
</li>
<li class="nav-item pl-3">
<a class="nav-link lead text-muted" href="/horizon">Redis Queue</a>
<a class="nav-link font-weight-bold text-muted" href="/horizon">Redis Queue</a>
</li>
<li class="nav-item pl-3 {{request()->is('settings*')?'active':''}}">
<a class="nav-link lead text-muted" href="#">Settings</a>
<a class="nav-link font-weight-bold text-muted" href="#">Settings</a>
</li>
</ul>
</div>

View file

@ -8,7 +8,7 @@
<div class="card-body p-0">
<div class="row">
@include('admin.partial.sidebar')
<div class="col-12 col-md-9 p-5">
<div class="col-12 col-md-9 p-4">
@if (session('status'))
<div class="alert alert-success">
{{ session('status')}}

View file

@ -1,13 +1,23 @@
@extends('admin.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Reports</h3>
<div class="title font-weight-bold">
<h3 class="">Reports</h3>
<p>
<span class="pr-3">
<span>Open:</span>
<span class="text-danger">{{App\Report::whereNull('admin_seen')->count()}}</span>
</span>
<span class="">
<span>Closed:</span>
<span class="text-success">{{App\Report::whereNotNull('admin_seen')->count()}}</span>
</span>
</p>
</div>
<hr>
<table class="table">
<table class="table table-responsive">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
@ -22,7 +32,7 @@
@foreach($reports as $report)
<tr>
<th scope="row">
<a href="{{$report->url()}}">
<a href="{{$report->url()}}" class="btn btn-sm btn-outline-primary">
{{$report->id}}
</a>
</th>

View file

@ -19,9 +19,9 @@
{{-- <a href="#" class="card-link font-weight-bold">Request Mod Feedback</a> --}}
<a href="#" class="card-link report-action-btn font-weight-bold" data-action="cw">Add CW</a>
<a href="#" class="card-link report-action-btn font-weight-bold" data-action="unlist">Unlist/Hide</a>
<a href="#" class="card-link report-action-btn font-weight-bold text-danger" data-action="delete">Delete</a>
{{-- <a href="#" class="card-link report-action-btn font-weight-bold text-danger" data-action="delete">Delete</a>
<a href="#" class="card-link report-action-btn font-weight-bold text-danger" data-action="shadowban">Shadowban User</a>
<a href="#" class="card-link report-action-btn font-weight-bold text-danger" data-action="ban">Ban User</a>
<a href="#" class="card-link report-action-btn font-weight-bold text-danger" data-action="ban">Ban User</a> --}}
@else
<p class="font-weight-bold mb-0">Resolved {{$report->admin_seen->diffForHumans()}}</p>
@endif

View file

@ -4,6 +4,9 @@ Route::domain(config('pixelfed.domain.admin'))->prefix('i/admin')->group(functio
Route::redirect('/', '/dashboard');
Route::redirect('timeline', config('app.url').'/timeline');
Route::get('dashboard', 'AdminController@home')->name('admin.home');
Route::get('reports', 'AdminController@reports')->name('admin.reports');
Route::get('reports/show/{id}', 'AdminController@showReport');
Route::post('reports/show/{id}', 'AdminController@updateReport');
Route::redirect('statuses', '/statuses/list');
Route::get('statuses/list', 'AdminController@statuses')->name('admin.statuses');
Route::get('statuses/show/{id}', 'AdminController@showStatus');