Skip to content

Commit 8622c14

Browse files
authored
Merge pull request #17 from aryehraber/feat/statamic-4
Support Statamic 4
2 parents 990bcd8 + 95589d4 commit 8622c14

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

composer.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"homepage": "https://github.com/aryehraber/statamic-logbook",
1111
"license": "MIT",
1212
"require": {
13-
"rap2hpoutre/laravel-log-viewer": "^2.2.0",
14-
"statamic/cms": "^3.3"
13+
"rap2hpoutre/laravel-log-viewer": "^2.3.0",
14+
"statamic/cms": "^4.0"
1515
},
1616
"autoload": {
1717
"psr-4": {
@@ -30,7 +30,7 @@
3030
"statamic": {
3131
"name": "Logbook",
3232
"description": "Manage and view log files in the CP.",
33-
"version": "2.2.0"
33+
"version": "3.0.0"
3434
},
3535
"laravel": {
3636
"providers": [
@@ -39,5 +39,10 @@
3939
}
4040
},
4141
"minimum-stability": "dev",
42-
"prefer-stable": true
42+
"prefer-stable": true,
43+
"config": {
44+
"allow-plugins": {
45+
"pixelfear/composer-dist-plugin": true
46+
}
47+
}
4348
}

resources/views/show.blade.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
<div class="card mb-2">
1717
<div class="flex items-center justify-between">
1818
<form class="flex" method="GET" action="{{ cp_route('utilities.logbook.show') }}">
19-
<div class="select-input-container relative">
20-
<select class="pr-4" name="log">
19+
<div class="select-input-container">
20+
<select class="select-input" name="log">
2121
@foreach($files as $file)
2222
<option value="{{ urlencode($file) }}" @if($file === $currentFile) selected @endif>{{ $file }}</option>
2323
@endforeach
2424
</select>
2525

26-
<svg-icon name="chevron-down-xs" class="absolute inset-y-0 right-0 w-2 h-full mr-1.5 pointer-events-none"></svg-icon>
26+
<div class="select-input-toggle">
27+
<svg-icon name="micro/chevron-down-xs" class="w-2"></svg-icon>
28+
</div>
2729
</div>
2830
</form>
2931

@@ -42,10 +44,10 @@
4244
@method('delete')
4345

4446
@if(count($files) > 1)
45-
<dropdown-list class="inline-block ml-1">
47+
<dropdown-list class="inline-block ml-2">
4648
<template #trigger>
47-
<button class="btn-danger flex items-center pr-2" type="button">
48-
{{ __('Delete Log') }} <svg-icon name="chevron-down-xs" class="w-2 ml-1"></svg-icon>
49+
<button class="btn-danger flex items-center pr-3 hover:text-white" type="button">
50+
{{ __('Delete Log') }} <svg-icon name="micro/chevron-down-xs" class="w-2 ml-2"></svg-icon>
4951
</button>
5052
</template>
5153

@@ -54,7 +56,7 @@
5456
<button name="log" value="all" data-delete>{{ __('Delete All Logs') }}</button>
5557
</dropdown-list>
5658
@else
57-
<button class="btn-danger ml-1" name="log" value="{{ urlencode($currentFile) }}" data-delete>{{ __('Delete Log') }}</button>
59+
<button class="btn-danger ml-2" name="log" value="{{ urlencode($currentFile) }}" data-delete>{{ __('Delete Log') }}</button>
5860
@endif
5961
</form>
6062
</div>

src/LogbookServiceProvider.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,29 @@
22

33
namespace AryehRaber\Logbook;
44

5-
use Statamic\Facades\Utility;
65
use Illuminate\Routing\Router;
6+
use Statamic\Facades\Utility;
77
use Statamic\Providers\AddonServiceProvider;
88

99
class LogbookServiceProvider extends AddonServiceProvider
1010
{
11+
protected $viewNamespace = 'logbook';
12+
1113
protected $scripts = [
1214
__DIR__.'/../resources/js/logbook.js'
1315
];
1416

15-
public function boot()
17+
public function bootAddon()
1618
{
17-
parent::boot();
18-
19-
$this->loadViewsFrom(__DIR__.'/../resources/views', 'logbook');
20-
21-
Utility::make('logbook')
22-
->title(__('Logbook'))
23-
->icon('book-pages')
24-
->description(__('Manage and view log files.'))
25-
->routes(function (Router $router) {
26-
$router->get('/', [LogbookController::class, 'show'])->name('show');
27-
$router->delete('/delete', [LogbookController::class, 'destroy'])->name('destroy');
28-
})
29-
->register();
19+
Utility::extend(function () {
20+
Utility::register('logbook')
21+
->title(__('Logbook'))
22+
->icon('book-pages')
23+
->description(__('Manage and view log files.'))
24+
->routes(function (Router $router) {
25+
$router->get('/', [LogbookController::class, 'show'])->name('show');
26+
$router->delete('/delete', [LogbookController::class, 'destroy'])->name('destroy');
27+
});
28+
});
3029
}
3130
}

0 commit comments

Comments
 (0)