Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Mar 5, 2024
1 parent 7773ab4 commit d5c20b9
Show file tree
Hide file tree
Showing 15 changed files with 221 additions and 163 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT
- name: "Slack notification: IN PROGRESS"
id: slack
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: 'C068A06PV43'
payload: |
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT
- name: "Slack notification: Done"
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: "Send a notification for failures"
if: ${{ failure() }}
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"gammamatrix",
"laravel",
"playground",
"playground",
"playground-blade"
],
"homepage": "https://github.com/gammamatrix/playground-blade/wiki",
Expand All @@ -20,11 +19,11 @@
],
"require": {
"php": "^8.1",
"gammamatrix/playground": "dev-develop|dev-master|^73.0"
"gammamatrix/playground": "dev-develop|dev-master|dev-feature/*|^73.0"
},
"require-dev": {
"gammamatrix/playground-auth": "dev-develop|dev-master|^73.0",
"gammamatrix/playground-test": "dev-develop|dev-master|^73.0",
"gammamatrix/playground-auth": "dev-develop|dev-master|dev-feature/*|^73.0",
"gammamatrix/playground-test": "dev-develop|dev-master|dev-feature/*|^73.0",
"tomasvotruba/bladestan": "^0.4.1"
},
"minimum-stability": "dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<form class="d-inline-block" method="POST"
action="{{ route($routeDelete, [$routeDeleteRelationship => $routeDeleteRelationshipId, 'relationship' => $routeDeleteRelationship]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<input type="hidden" name="data[0][type]" value="{{ $routeDeleteRelationship }}">
<input type="hidden" name="data[0][id]" value="{{ $record['id'] }}">
<button type="submit" class="btn btn-danger ms-2" role="button">
<span class="fa-solid fa-xmark"></span>
<span class="d-none d-inline-sm">Delete</span>
</button>
</form>
10 changes: 10 additions & 0 deletions resources/views/components/table/data-row-actions-delete.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<form class="d-inline-block" method="POST"
action="{{ route($routeDelete, [$routeParameter => $record[$routeParameterKey]]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<button type="submit" class="btn btn-danger ms-2" role="button">
<span class="fa-solid fa-xmark"></span>
<span class="d-none d-sm-inline">Delete</span>
</button>
</form>
19 changes: 19 additions & 0 deletions resources/views/components/table/data-row-actions-edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@if (!empty($record['deleted_at']) && $routeRestore)
<form class="d-inline-block" method="POST"
action="{{ route($routeRestore, [$routeParameter => $record[$routeParameterKey]]) }}">
@method('PUT')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<button type="submit" class="btn btn-primary" role="button">
<i class="fa-solid fa-recycle"></i>
<span class="d-none d-sm-inline">Restore</span>
</button>
</form>
@elseif ($withEdit && $routeEdit)
<a class="btn btn-primary"
href="{{ route($routeEdit, [$routeParameter => $record[$routeParameterKey], '_return_url' => $returnUrl]) }}"
role="button">
<i class="fa-solid fa-pen"></i>
<span class="d-none d-sm-inline">Edit</span>
</a>
@endif
10 changes: 10 additions & 0 deletions resources/views/components/table/data-row-actions-unlock.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<form class="d-inline-block" method="POST"
action="{{ route($routeUnlock, [$routeParameter => $record[$routeParameterKey]]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<button type="submit" class="btn btn-danger ms-2" role="button">
<span class="fas fa-unlock text-success"></span>
<span class="d-none d-sm-inline">Unlock</span>
</button>
</form>
59 changes: 7 additions & 52 deletions resources/views/components/table/data-row-actions.blade.php
Original file line number Diff line number Diff line change
@@ -1,57 +1,12 @@
<th>
<div class="text-nowrap" role="group" aria-label="{{ __('playground::pagination.row.actions.label') }}">

@php
if (!empty($record['deleted_at'])) {
$withDelete = false;
}
@endphp

@if ($withDelete && $routeDeleteRelationship && $routeDelete)
<form class="d-inline-block" method="POST"
action="{{ route($routeDelete, ['product' => $routeDeleteRelationshipId, 'relationship' => $routeDeleteRelationship]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<input type="hidden" name="data[0][type]" value="{{ $routeDeleteRelationship }}">
<input type="hidden" name="data[0][id]" value="{{ $record['id'] }}">
<button type="submit" class="btn btn-danger ms-2" role="button">
<span class="fa-solid fa-xmark"></span>
<span class="d-none d-inline-sm">Delete</span>
</button>
</form>
@elseif ($withDelete && $routeDelete)
<form class="d-inline-block" method="POST"
action="{{ route($routeDelete, [$routeParameter => $record[$routeParameterKey]]) }}">
@method('DELETE')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<button type="submit" class="btn btn-danger ms-2" role="button">
<span class="fa-solid fa-xmark"></span>
<span class="d-none d-sm-inline">Delete</span>
</button>
</form>
@if ($withUnlock && !empty($record['locked']) && $routeUnlock)
@include('playground::components/table/data-row-actions-unlock')
@else
@if ($withDelete && $routeDelete && empty($record['deleted_at']))
@include('playground::components/table/data-row-actions-delete')
@endif
@include('playground::components/table/data-row-actions-edit')
@endif

@if (!empty($record['deleted_at']) && $routeRestore)
<form class="d-inline-block" method="POST"
action="{{ route($routeRestore, [$routeParameter => $record[$routeParameterKey]]) }}">
@method('PUT')
@csrf
<input type="hidden" name="_return_url" value="{{ $returnUrl }}">
<button type="submit" class="btn btn-primary" role="button">
<i class="fa-solid fa-recycle"></i>
<span class="d-none d-sm-inline">Restore</span>
</button>
</form>
@elseif ($withEdit && $routeEdit)
<a class="btn btn-primary"
href="{{ route($routeEdit, [$routeParameter => $record[$routeParameterKey], '_return_url' => $returnUrl]) }}"
role="button">
<i class="fa-solid fa-pen"></i>
<span class="d-none d-sm-inline">Edit</span>
</a>
@endif

</div>
</th>
7 changes: 7 additions & 0 deletions resources/views/components/table/data.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
'roles' => ['admin', 'manager'],
])->allowed();
$withUnlock = \Playground\Auth\Facades\Can::access($user, [
'allow' => false,
'any' => true,
'privilege' => $withPrivilege . ':unlock',
'roles' => ['admin', 'manager'],
])->allowed();
/**
* @var array<string, array<string, mixed>> $columns The columns in the table, keyed by slug.
*/
Expand Down
156 changes: 90 additions & 66 deletions resources/views/layouts/resource/detail-information.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,87 +20,111 @@
{{ __('Edit') }} <span class="fas fa-edit float-end"></span>
</a>
</div>
@endif
<h1>{{ $data->getAttributeValue($meta['info']['model_attribute']) }}</h1>
</div>
@if ($withImage && $data && $data->image)
<div class="card-header">
<img class="card-img-top" src="{{ $data->image }}" alt="{{ $meta['info']['model_label'] }} Image">
</div>
@endif
<h1>{{ $data->label }}</h1>
</div>
@if ($withImage && $data && $data->image)
<div class="card-header">
<img class="card-img-top" src="{{ $data->image }}" alt="{{ $meta['info']['model_label'] }} Image">
</div>
@endif
<div class="card-body">
<div class="card-body">

<h2>{{ __('Information') }}</h2>
<h2>{{ __('Information') }}</h2>

<table class="table">
<tbody>
<tr>
<th scope="row">{{ __('Slug') }}</th>
<td>{{ $data->slug }}</td>
</tr>
@if ($parent)
<table class="table">
<tbody>
<tr>
<th scope="row">{{ __('Parent ' . $meta['info']['model_label']) }}</th>
<th scope="row">{{ __('Slug') }}</th>
<td>{{ $data->slug }}</td>
</tr>
@if ($parent)
<tr>
<th scope="row">{{ __('Parent ' . $meta['info']['model_label']) }}</th>
<td>
<a
href="{{ route(sprintf('%1$s.show', $meta['info']['model_route']), [$meta['info']['model_slug'] => $parent->id]) }}">
{{ $parent->label }}
</a>
</td>
</tr>
@endif
<tr>
<th scope="row">{{ __('Created') }}</th>
<td>
<a
href="{{ route(sprintf('%1$s.show', $meta['info']['model_route']), [$meta['info']['model_slug'] => $parent->id]) }}">
{{ $parent->label }}
</a>
@if ($data->created_at)
<time datetime="{{ $data['created_at'] }}">{{ $data['created_at'] }}</time>
@endif
</td>
</tr>
@endif
<tr>
<th scope="row">{{ __('Created') }}</th>
<td>
@if ($data->created_at)
<time datetime="{{ $data['created_at'] }}">{{ $data['created_at'] }}</time>
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('Updated') }}</th>
<td>
@if ($data->updated_at)
<time datetime="{{ $data['updated_at'] }}">{{ $data['updated_at'] }}</time>
@endif
</td>
</tr>
<tr>
<th scope="row">{{ __('Active') }}</th>
<td>
@if ($data->active)
<span class="fas fa-check"></span>
@endif
</td>
</tr>
@yield('detail-information-table')
</tbody>
</table>
<tr>
<th scope="row">{{ __('Updated') }}</th>
<td>
@if ($data->updated_at)
<time datetime="{{ $data['updated_at'] }}">{{ $data['updated_at'] }}</time>
@endif
</td>
</tr>
@yield('detail-information-table')
</tbody>
</table>

@if ($data->description)
<h4>{{ __('Description') }}</h4>
@if ($data->description)
<h4>{{ __('Description') }}</h4>

<div class="description">{{ $data->description }}</div>
@endif
<div class="description">{{ $data->description }}</div>
@endif

@if ($data->introduction)
<h4>{{ __('Introduction') }}</h4>
@if ($data->introduction)
<h4>{{ __('Introduction') }}</h4>

<div class="introduction">{{ $data->introduction }}</div>
@endif
<div class="introduction">{{ $data->introduction }}</div>
@endif

@if ($data->content)
<h4>{{ __('Content') }}</h4>
@if ($data->content)
<h4>{{ __('Content') }}</h4>

<div class="content">{!! $data->content !!}</div>
@endif
<div class="content">{!! $data->content !!}</div>
@endif

@if ($data->summary)
<h4>{{ __('Summary') }}</h4>
@if ($data->summary)
<h4>{{ __('Summary') }}</h4>

<div class="summary">{!! $data->summary !!}</div>
@endif
<div class="summary">{!! $data->summary !!}</div>
@endif

</div>
</div>

<div class="card-footer">
@if ($data->active)
<span class="badge text-bg-secondary">
<i class="fa-solid fa-person-running"></i>
{{ __('Active') }}
</span>
@endif
@if ($data->locked)
<span class="badge text-bg-secondary">
<i class="fa-solid fa-lock text-warning"></i>
{{ __('Locked') }}
</span>
@endif
</div>


<div class="card-footer">
<ul class="list-group list-group-flush">
@if ($data->active)
<li class="list-group-item">
<i class="fa-solid fa-person-running"></i>
{{ __('Active') }}
</li>
@endif
@if ($data->locked)
<li class="list-group-item">
<i class="fa-solid fa-lock text-warning"></i>
{{ __('Locked') }}
</li>
@endif
</ul>
</div>
</div>
8 changes: 8 additions & 0 deletions resources/views/layouts/resource/detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
$withPrivilege = !empty($meta['info']) && !empty($meta['info']['privilege']) && is_string($meta['info']['privilege']) ? $meta['info']['privilege'] : 'playground';
$routeUnlock = !$data ? '' : route(sprintf('%1$s.unlock', $meta['info']['model_route']), [$meta['info']['model_slug'] => $data->getAttributeValue('id')]);
$routeDelete = !$data ? '' : route(sprintf('%1$s.destroy', $meta['info']['model_route']), [$meta['info']['model_slug'] => $data->getAttributeValue('id')]);
$routeEdit = !$data ? '' : route(sprintf('%1$s.edit', $meta['info']['model_route']), [$meta['info']['model_slug'] => $data->getAttributeValue('id')]);
Expand All @@ -54,6 +55,13 @@
'roles' => ['admin', 'manager'],
])->allowed();
$withUnlock = \Playground\Auth\Facades\Can::access($user, [
'allow' => false,
'any' => true,
'privilege' => $withPrivilege . ':unlock',
'roles' => ['admin', 'manager'],
])->allowed();
/**
* @var boolean|string $withInfo
*/
Expand Down
Loading

0 comments on commit d5c20b9

Please sign in to comment.