diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ManageController.php similarity index 53% rename from app/Http/Controllers/ImportController.php rename to app/Http/Controllers/ManageController.php index 476bc88..5ffac31 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ManageController.php @@ -4,21 +4,49 @@ namespace App\Http\Controllers; use App\Http\Requests\ImportRequest; use App\Services\Import; +use App\Tag; use Illuminate\Http\Request; -class ImportController extends Controller +class ManageController extends Controller { public function __construct() { $this->middleware('auth'); } - public function form(Request $request) + public function tags() { - return view('import')->with(['page_title' => 'Importer']); + $tags = Tag::withCount('posts') + ->orderByDesc('posts_count') + ->get(); + + return view('manage.tags')->with([ + 'page_title' => __('Tags'), + 'tags' => $tags, + ]); } - public function store(ImportRequest $request) + public function deleteTag(Request $request, string $tag, string $hash) + { + if ($hash != csrf_token()) { + abort(403); + } + + $tag = Tag::findNamedOrCreate($tag); + $tag->delete(); + + $this->flash("Le tag \"{$tag->name}\" a été supprimé !", 'success'); + return redirect()->back(); + } + + public function importForm(Request $request) + { + return view('manage.import')->with([ + 'page_title' => __('Import') + ]); + } + + public function importStore(ImportRequest $request) { try { $import = new Import( diff --git a/resources/lang/fr.json b/resources/lang/fr.json index 09995d8..947975b 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -46,6 +46,7 @@ "Whoops!": "Oups !", "Whoops, something went wrong on our servers.": "Oups, quelque chose s'est mal passé sur nos serveurs.", "Manage": "Gestion", + "Tags": "Tags", "Link": "Lien", "Story": "Story", "Chest": "Coffre", diff --git a/resources/sass/app.scss b/resources/sass/app.scss index b4c5e8e..00c62e6 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -23,6 +23,10 @@ nav.navbar, box-shadow: $box-shadow-sm; } +.card { + box-shadow: $box-shadow-sm; +} + #app { display: flex; flex-direction: column; diff --git a/resources/views/import.blade.php b/resources/views/import.blade.php deleted file mode 100644 index 4a01e79..0000000 --- a/resources/views/import.blade.php +++ /dev/null @@ -1,68 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
-
-
-
{{ __('Import') }}
- -
-
- Attention, l'import a été testé avec la version 0.0.41 de Shaarli. Faites une sauvegarde avant toute tentative. -
- -

- Vous pouvez importer votre contenu depuis le Shaarli originel. Importez le fichier data/datastore.php (par défaut) - et vérifiez qu'il commence par <?php /* et se termine par */ ?>. -

-
- - -
-
-
-
-@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d201a4f..cb1b3fc 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,89 +1,16 @@ - + - - - @if(isset($page_title)){{ $page_title }} - @endif{{ config('app.name') }} - - @if(auth()->check()) - - @endif - @stack('meta') - @include('feed::links') - - - - @stack('css') + @include('layouts.partials.head')
- - + @include('layouts.partials.navbar')
@yield('content')
- - - - @include('partials.flash') + @include('layouts.partials.footer')
- - - @stack('js') + @include('layouts.partials.scripts') diff --git a/resources/views/layouts/manage.blade.php b/resources/views/layouts/manage.blade.php new file mode 100644 index 0000000..2fe96da --- /dev/null +++ b/resources/views/layouts/manage.blade.php @@ -0,0 +1,32 @@ + + + + @include('layouts.partials.head') + + +
+ @include('layouts.partials.navbar') +
+
+
+ +
+ @yield('content') +
+
+
+
+ @include('layouts.partials.footer') +
+ @include('layouts.partials.scripts') + + diff --git a/resources/views/layouts/partials/footer.blade.php b/resources/views/layouts/partials/footer.blade.php new file mode 100644 index 0000000..38be2f4 --- /dev/null +++ b/resources/views/layouts/partials/footer.blade.php @@ -0,0 +1,9 @@ + + +@include('partials.flash') \ No newline at end of file diff --git a/resources/views/layouts/partials/head.blade.php b/resources/views/layouts/partials/head.blade.php new file mode 100644 index 0000000..f91f7b1 --- /dev/null +++ b/resources/views/layouts/partials/head.blade.php @@ -0,0 +1,13 @@ + + +@if(isset($page_title)){{ $page_title }} - @endif{{ config('app.name') }} + +@if(auth()->check()) + +@endif +@stack('meta') +@include('feed::links') + + + +@stack('css') \ No newline at end of file diff --git a/resources/views/layouts/partials/navbar.blade.php b/resources/views/layouts/partials/navbar.blade.php new file mode 100644 index 0000000..83a710d --- /dev/null +++ b/resources/views/layouts/partials/navbar.blade.php @@ -0,0 +1,55 @@ + \ No newline at end of file diff --git a/resources/views/layouts/partials/scripts.blade.php b/resources/views/layouts/partials/scripts.blade.php new file mode 100644 index 0000000..341d064 --- /dev/null +++ b/resources/views/layouts/partials/scripts.blade.php @@ -0,0 +1,2 @@ + +@stack('js') \ No newline at end of file diff --git a/resources/views/manage/import.blade.php b/resources/views/manage/import.blade.php new file mode 100644 index 0000000..1ecf535 --- /dev/null +++ b/resources/views/manage/import.blade.php @@ -0,0 +1,66 @@ +@extends('layouts.manage') + +@section('content') +
+
+
+
{{ __('Import') }}
+ +
+
+ Attention, l'import a été testé avec la version 0.0.41 de Shaarli. Faites une sauvegarde avant toute tentative. +
+ +

+ Vous pouvez importer votre contenu depuis le Shaarli originel. Importez le fichier data/datastore.php (par défaut) + et vérifiez qu'il commence par <?php /* et se termine par */ ?>. +

+
+ + +
+
+
+@endsection diff --git a/resources/views/manage/tags.blade.php b/resources/views/manage/tags.blade.php new file mode 100644 index 0000000..094e110 --- /dev/null +++ b/resources/views/manage/tags.blade.php @@ -0,0 +1,40 @@ +@extends('layouts.manage') + +@section('content') +
+
+
+
{{ __('Import') }}
+ +
+ @if($tags->isEmpty()) +
Aucun tag.
+ @else + + + + + + + + + + @foreach($tags as $tag) + + + + + + @endforeach + +
NomPosts#
+ {{ $tag->name }} + {{ $tag->posts_count }} + Supprimer +
+ @endif +
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index b9b769a..9fddb37 100644 --- a/routes/web.php +++ b/routes/web.php @@ -33,5 +33,8 @@ Route::get('chest/{chest}', 'BrowseController@chest')->name('chest.view'); Route::get('account', 'AccountController@form')->name('account'); Route::post('account', 'AccountController@store'); Route::post('account/password', 'AccountController@storePassword')->name('account.password'); -Route::get('import', 'ImportController@form')->name('import'); -Route::post('import', 'ImportController@store'); + +Route::get('manage/import', 'ManageController@importForm')->name('manage.import'); +Route::post('manage/import', 'ManageController@importStore'); +Route::get('manage/tags', 'ManageController@tags')->name('manage.tags'); +Route::get('manage/tags/delete/{tag}/{hash}', 'ManageController@deleteTag')->name('manage.tags.delete');