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') -
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 */ ?>
.
-
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 */ ?>
.
+
Nom | +Posts | +# | +
+ {{ $tag->name }} + | +{{ $tag->posts_count }} | ++ Supprimer + | +