From a8e2049d0888ac92832ea0593186c97c1cfd22d8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 14 Sep 2017 15:32:53 -0400 Subject: [PATCH] Refactor a bit to prepare for manga collection --- app/appConf/routes.php | 68 +++++++++++++++---- app/views/collection/cover.php | 4 +- app/views/collection/edit.php | 2 +- app/views/collection/list.php | 4 +- app/views/main-menu.php | 8 ++- composer.json | 2 +- .../{Collection.php => AnimeCollection.php} | 5 +- src/Dispatcher.php | 8 ++- 8 files changed, 77 insertions(+), 24 deletions(-) rename src/Controller/{Collection.php => AnimeCollection.php} (96%) diff --git a/app/appConf/routes.php b/app/appConf/routes.php index 0d3e5971..08e32bd0 100644 --- a/app/appConf/routes.php +++ b/app/appConf/routes.php @@ -16,6 +16,7 @@ use const Aviat\AnimeClient\{ + DEFAULT_CONTROLLER_NAMESPACE, DEFAULT_CONTROLLER_METHOD, DEFAULT_CONTROLLER }; @@ -85,48 +86,87 @@ return [ // --------------------------------------------------------------------- // Anime Collection Routes // --------------------------------------------------------------------- - 'collection.search' => [ - 'path' => '/collection/search', + 'anime.collection.search' => [ + 'path' => '/anime-collection/search', 'action' => 'search', ], - 'collection.add.get' => [ - 'path' => '/collection/add', + 'anime.collection.add.get' => [ + 'path' => '/anime-collection/add', 'action' => 'form', 'params' => [], ], - 'collection.edit.get' => [ - 'path' => '/collection/edit/{id}', + 'anime.collection.edit.get' => [ + 'path' => '/anime-collection/edit/{id}', 'action' => 'form', 'tokens' => [ 'id' => '[0-9]+', ], ], - 'collection.add.post' => [ - 'path' => '/collection/add', + 'anime.collection.add.post' => [ + 'path' => '/anime-collection/add', 'action' => 'add', 'verb' => 'post', ], - 'collection.edit.post' => [ - 'path' => '/collection/edit', + 'anime.collection.edit.post' => [ + 'path' => '/anime-collection/edit', 'action' => 'edit', 'verb' => 'post', ], - 'collection.view' => [ - 'path' => '/collection/view{/view}', + 'anime.collection.view' => [ + 'path' => '/anime-collection/view{/view}', 'action' => 'index', 'params' => [], 'tokens' => [ 'view' => '[a-z_]+', ], ], - 'collection.delete' => [ - 'path' => '/collection/delete', + 'anime.collection.delete' => [ + 'path' => '/anime-collection/delete', 'action' => 'delete', 'verb' => 'post', ], // --------------------------------------------------------------------- // Manga Collection Routes // --------------------------------------------------------------------- + 'manga.collection.search' => [ + 'path' => '/manga-collection/search', + 'action' => 'search', + ], + 'manga.collection.add.get' => [ + 'path' => '/manga-collection/add', + 'action' => 'form', + 'params' => [], + ], + 'manga.collection.edit.get' => [ + 'path' => '/manga-collection/edit/{id}', + 'action' => 'form', + 'tokens' => [ + 'id' => '[0-9]+', + ], + ], + 'manga.collection.add.post' => [ + 'path' => '/manga-collection/add', + 'action' => 'add', + 'verb' => 'post', + ], + 'manga.collection.edit.post' => [ + 'path' => '/manga-collection/edit', + 'action' => 'edit', + 'verb' => 'post', + ], + 'manga.collection.view' => [ + 'path' => '/manga-collection/view{/view}', + 'action' => 'index', + 'params' => [], + 'tokens' => [ + 'view' => '[a-z_]+', + ], + ], + 'manga.collection.delete' => [ + 'path' => '/manga-collection/delete', + 'action' => 'delete', + 'verb' => 'post', + ], // --------------------------------------------------------------------- // Other Routes // --------------------------------------------------------------------- diff --git a/app/views/collection/cover.php b/app/views/collection/cover.php index d35f1274..6ae83460 100644 --- a/app/views/collection/cover.php +++ b/app/views/collection/cover.php @@ -1,6 +1,6 @@
isAuthenticated()): ?> -Add Item +Add Item

There's nothing here!

@@ -23,7 +23,7 @@ isAuthenticated()): ?>
- Edit diff --git a/app/views/collection/edit.php b/app/views/collection/edit.php index ab0f4a53..71bffc41 100644 --- a/app/views/collection/edit.php +++ b/app/views/collection/edit.php @@ -47,7 +47,7 @@
Danger Zone -
+ diff --git a/app/views/collection/list.php b/app/views/collection/list.php index 9aadb119..8d0bb6c3 100644 --- a/app/views/collection/list.php +++ b/app/views/collection/list.php @@ -1,6 +1,6 @@
isAuthenticated()): ?> -Add Item +Add Item

There's nothing here!

@@ -26,7 +26,7 @@
isAuthenticated()): ?>