Merge branch 'develop' into trunk

This commit is contained in:
Jérémy Munsch 2021-07-27 12:51:54 +02:00
commit e23388c2d5
4 changed files with 68 additions and 7 deletions

View file

@ -10,6 +10,7 @@ class ProjectController extends Controller
{
use CrudController {
index as crudIndex;
show as crudShow;
}
/** @var Project */
@ -26,4 +27,11 @@ class ProjectController extends Controller
}
return view('projects.index', $view->getData());
}
public function show(Project $model)
{
/** @var \Illuminate\View\View */
$view = $this->crudshow($model);
return view('projects.show', $view->getData());
}
}

View file

@ -31,7 +31,7 @@ class LogPolicy extends RootPolicy
'log' => [
'viewAny' => URR::make('userIsAdmin', $user),
'view' => URR::make('denyEveryOne'),
'update' => StaticRules::or([
'update' => StaticRules::and([
URR::make('userIsDev', $user),
LogStaticRules::make('logIsOwnedByUser', $user, $model)
]),

View file

@ -51,8 +51,11 @@
<div class="col-8 mt-5 @if($loop->even)float-end @else float-start @endif">
<div class="card text-center">
<div class="card-header">
<div class="d-inline-block badge bg-primary fs-6 mt-1">
{{ $model->created_at }}
<div class="d-inline-block float-start">
<span class="badge bg-primary fs-6 mt-1">
{{ $model->created_at }}
</span>
<span class="ms-3 mt-1 d-inline-block bg-dark text-info">&nbsp;{{ $model->user->name }}&nbsp;$&nbsp;</span>
</div>
<div class="btn-group float-end" role="group" aria-label="{{ Str::plural(__('crud-policies::crud.action')) }}">
@can('view', $model)
@ -71,10 +74,7 @@
</div>
</div>
<div class="card-body">
<h5 class="card-title">{{ __('Par :username', [
'username' => $model->user->name
])}}</h5>
<div class="card-text">{{ $model->entry }}</div>
<div class="card-text text-start">{!! $model->entry !!}</div>
</div>
</div>
</div>

View file

@ -0,0 +1,53 @@
@extends($viewLayout)
@section('title', sprintf('%s - %s', transFb(sprintf('models.classes.%s', strtolower(Str::plural(class_basename($modelClass)))), Str::plural(class_basename($modelClass))), __('crud-policies::crud.view')))
@section('description', sprintf('%s %s', __('crud-policies::crud.view'), trans(class_basename($modelClass))))
@section('metaIndex', 'noindex,nofollow')
@section('content')
<div class="card">
@include('crud-policies::crud.modules.flashMessage')
<div class="card-header">
@include('crud-policies::crud.modules.breadcrumb', ['action' => CrudAction::view()])
@include('crud-policies::crud.modules.actionbar.bar', ['action' => CrudAction::view()])
</div>
<div class="card-body">
<table class="table table-sm table-bordered border-primary align-top table-striped text-center">
<thead class="thead-dark">
<tr>
<th scope="col" class="w-25">{{ __('crud-policies::crud.property') }}</th>
<th scope="col" class="w-75">{{ __('crud-policies::crud.value') }}</th>
</tr>
</thead>
<tbody>
@foreach ($modelClass::getEditableProperties() as $fieldName => $prop)
@if(in_array(CrudAction::view(), $prop['actions']))
@switch($prop['type'])
@case(CrudType::password())
{{-- Ignore --}}
@break
@default
<tr>
<td>{{ $prop['label'] }}</td>
@switch($fieldName)
@case('description')
@case('todo')
<td>{!! $model->{$fieldName} !!}</td>
@break
@default
<td>@include('crud-policies::crud.printfield', [
'action' => CrudAction::view(),
'field' => $model->{$fieldName},
'props' => $prop
])</td>
@endswitch
</tr>
@endswitch
@endif
@endforeach
</tbody>
</table>
</div>
</div>
@include('crud-policies::crud.modules.scriptConstants')
@endsection