FEATURE: add filter to action log
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Admin\ActionLog;
|
|||||||
|
|
||||||
use App\Http\Controllers\Admin\Controller;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use App\Models\ActionLog;
|
use App\Models\ActionLog;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
|
||||||
class Overview extends Controller
|
class Overview extends Controller
|
||||||
{
|
{
|
||||||
@@ -23,13 +25,27 @@ class Overview extends Controller
|
|||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get overview of logged actions
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
public function getOverview()
|
public function getOverview()
|
||||||
{
|
{
|
||||||
$actions = $this->log->getLogActionsQuery(true)
|
$user = null;
|
||||||
->paginate(25);
|
$userId = Input::get('userId');
|
||||||
|
|
||||||
|
$actions = $this->log->getLogActionsQuery(true);
|
||||||
|
|
||||||
|
if ($userId) {
|
||||||
|
$user = User::findOrFail($userId);
|
||||||
|
$actions->where('users.id', $userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = $actions->paginate(25);
|
||||||
|
|
||||||
$this->log->translateLogMessages($actions);
|
$this->log->translateLogMessages($actions);
|
||||||
|
|
||||||
return view('admin.actionLog.overview', ['actions' => $actions]);
|
return view('admin.actionLog.overview', ['actions' => $actions, 'user' => $user]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UserDetail extends Controller
|
|||||||
// try to find given user
|
// try to find given user
|
||||||
$user = User::findOrFail($id);
|
$user = User::findOrFail($id);
|
||||||
|
|
||||||
$actions = $this->log->getUserActions($id);
|
$actions = $this->log->getUserActions($id, 10);
|
||||||
|
|
||||||
$roles = UserRoles::getWithTranslations();
|
$roles = UserRoles::getWithTranslations();
|
||||||
$states = UserStates::getWithTranslations();
|
$states = UserStates::getWithTranslations();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ return [
|
|||||||
"deleteContent" => 'Smazána stránka ":title", url "url a ID #:id. Tato změna je zaznamenána v revizi :revision.',
|
"deleteContent" => 'Smazána stránka ":title", url "url a ID #:id. Tato změna je zaznamenána v revizi :revision.',
|
||||||
"deleteCustomField" => "a",
|
"deleteCustomField" => "a",
|
||||||
"deleteWidgetArea" => "Smazal plochu pro widget :name",
|
"deleteWidgetArea" => "Smazal plochu pro widget :name",
|
||||||
|
"displayingUsersActions" => "Zobrazuji všechny akce od uživatele :name (:email).",
|
||||||
"draftFromContent" => "Upraven widget :name (#:id)",
|
"draftFromContent" => "Upraven widget :name (#:id)",
|
||||||
"editContent" => 'Editace stránky - nový titulek je ":title", url :url a ID #:id. Revize změny: :revision.',
|
"editContent" => 'Editace stránky - nový titulek je ":title", url :url a ID #:id. Revize změny: :revision.',
|
||||||
"editCustomField" => "a",
|
"editCustomField" => "a",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ return [
|
|||||||
"editUser" => "Editace uživatele :name (:email)",
|
"editUser" => "Editace uživatele :name (:email)",
|
||||||
"email" => "E-mail",
|
"email" => "E-mail",
|
||||||
"gravatarLink" => 'Nastavte si avatar na <a href="http://gravatar.com">gravatar.com</a>',
|
"gravatarLink" => 'Nastavte si avatar na <a href="http://gravatar.com">gravatar.com</a>',
|
||||||
|
"moreUserActions" => "Zobrazit více...",
|
||||||
"name" => "Celé jméno",
|
"name" => "Celé jméno",
|
||||||
"noActions" => "Uživatel zatím v systému nic neudělal.",
|
"noActions" => "Uživatel zatím v systému nic neudělal.",
|
||||||
"noUsers" => "Žádní uživatelé.",
|
"noUsers" => "Žádní uživatelé.",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
|
'displayingUsersActions' => 'Displaying actions performed by user :name (:email)',
|
||||||
'ip' => 'IP address',
|
'ip' => 'IP address',
|
||||||
'userAgent' => 'Browser identification',
|
'userAgent' => 'Browser identification',
|
||||||
'overview' => 'List of all actions',
|
'overview' => 'List of all actions',
|
||||||
|
|||||||
@@ -28,5 +28,6 @@ return [
|
|||||||
'userDetail' => 'Information',
|
'userDetail' => 'Information',
|
||||||
'edit' => 'Edit user',
|
'edit' => 'Edit user',
|
||||||
'noActions' => 'There are no actions yet.',
|
'noActions' => 'There are no actions yet.',
|
||||||
'gravatarLink' => 'Setup avatar at <a href="http://gravatar.com">gravatar.com</a>'
|
'gravatarLink' => 'Setup avatar at <a href="http://gravatar.com">gravatar.com</a>',
|
||||||
|
'moreUserActions' => 'More actions of this user'
|
||||||
];
|
];
|
||||||
@@ -2,33 +2,43 @@
|
|||||||
|
|
||||||
@section('pageHeading', @trans('admin/actionLog.overview'))
|
@section('pageHeading', @trans('admin/actionLog.overview'))
|
||||||
|
|
||||||
@section('content')
|
@if($user)
|
||||||
@if (!empty($actions))
|
@section('pageDescription', @trans('admin/actionLog.displayingUsersActions', ['name' => $user->name, 'email' => $user->email]))
|
||||||
<ul class="timeline">
|
@endif
|
||||||
<?php $odd = false; ?>
|
|
||||||
|
|
||||||
@foreach($actions as $action)
|
|
||||||
<li @if($odd) class="timeline-inverted" @endif>
|
@section('content')
|
||||||
<?php $odd = !$odd;?>
|
@if (!empty($actions))
|
||||||
<div class="timeline-badge big" style="background: url('{{\App\Helpers\Gravatar::img($action->email, 40)}}') no-repeat center center" data-toggle="tooltip" data-placement="top" title="{{$action->user_name}} {{$action->email}}"></div>
|
<ul class="timeline">
|
||||||
<div class="timeline-panel">
|
<?php $odd = false; ?>
|
||||||
<div class="timeline-heading">
|
|
||||||
<h5 class="timeline-title">{{$action->name}} <small class="text-muted">
|
@foreach($actions as $action)
|
||||||
@date($action->created_at)
|
<li @if($odd) class="timeline-inverted" @endif>
|
||||||
</small></h5>
|
<?php $odd = !$odd;?>
|
||||||
</div>
|
<div class="timeline-badge big"
|
||||||
<div class="timeline-body">
|
style="background: url('{{\App\Helpers\Gravatar::img($action->email, 40)}}') no-repeat center center"
|
||||||
<p>{!! $action->value !!}</p>
|
data-toggle="tooltip" data-placement="top"
|
||||||
</div>
|
title="{{$action->user_name}} {{$action->email}}"></div>
|
||||||
</div>
|
<div class="timeline-panel">
|
||||||
</li>
|
<div class="timeline-heading">
|
||||||
@endforeach
|
<h5 class="timeline-title">{{$action->name}}
|
||||||
</ul>
|
<small class="text-muted">
|
||||||
@else
|
@date($action->created_at)
|
||||||
<div class="alert alert-info">
|
</small>
|
||||||
<em>@lang('admin/userManagement.noActions')</em>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
<div class="timeline-body">
|
||||||
|
<p>{!! $action->value !!}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
@else
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<em>@lang('admin/userManagement.noActions')</em>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="row text-center">
|
<div class="row text-center">
|
||||||
{!! $actions->render() !!}
|
{!! $actions->render() !!}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
@section('pageHeading', trans('admin/userManagement.profile'))
|
@section('pageHeading', trans('admin/userManagement.profile'))
|
||||||
@section('pageDescription', @trans('admin/userManagement.detail', ['name' => $user->name, 'email' => $user->email]))
|
@section('pageDescription', @trans('admin/userManagement.detail', ['name' => $user->name, 'email' => $user->email]))
|
||||||
@section('headerButtons')
|
@section('headerButtons')
|
||||||
<a href="{{route('users.overview')}}" class="btn btn-secondary btn-sm rounded" title="@lang('admin/userManagement.overview')">
|
<a href="{{route('users.overview')}}" class="btn btn-secondary btn-sm rounded"
|
||||||
|
title="@lang('admin/userManagement.overview')">
|
||||||
<i class="fa fa-list"></i>
|
<i class="fa fa-list"></i>
|
||||||
</a>
|
</a>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -85,6 +86,14 @@
|
|||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<a href="{{route('log.overview', ['userId' => $user->id])}}"
|
||||||
|
class="btn btn-secondary">@lang('admin/userManagement.moreUserActions')</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@else
|
@else
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<em>@lang('admin/userManagement.noActions')</em>
|
<em>@lang('admin/userManagement.noActions')</em>
|
||||||
|
|||||||
Reference in New Issue
Block a user