From 9c818366484ff2727b28dc932372697ffcff0946 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 4 Jan 2016 10:53:03 -0500 Subject: [PATCH] Add full edit form to anime list --- app/bootstrap.php | 2 +- app/config/minify_js_groups.php | 8 ++ app/config/routes.php | 26 ++-- app/views/anime/add.php | 40 ++++++ app/views/anime/cover.php | 24 +++- app/views/anime/edit.php | 89 +++++++++++- app/views/anime/list.php | 44 ++++-- app/views/collection/add.php | 54 +++---- app/views/collection/cover.php | 14 +- app/views/collection/edit.php | 67 +++++---- app/views/collection/list.php | 28 ++-- app/views/header.php | 78 +++++----- app/views/login.php | 27 ++-- app/views/message.php | 2 +- public/css/base.css | 73 ++++++++++ public/css/base.myth.css | 59 +++++++- public/css/marx.css | 6 +- public/js/anime_edit.js | 8 +- src/Aviat/AnimeClient/AnimeClient.php | 28 +++- .../AnimeClient/Auth/HummingbirdAuth.php | 3 +- src/Aviat/AnimeClient/Controller.php | 106 +++++++++++++- src/Aviat/AnimeClient/Controller/Anime.php | 133 +++++++++++++++++- .../AnimeClient/Controller/Collection.php | 1 - src/Aviat/AnimeClient/Dispatcher.php | 19 ++- .../Transformer/AnimeListTransformer.php | 37 ++++- src/Aviat/AnimeClient/Model/Anime.php | 41 +++++- src/Aviat/AnimeClient/RoutingBase.php | 2 +- src/Aviat/Ion/Enum/MessageType.php | 0 src/Aviat/Ion/View.php | 33 ++++- tests/AnimeClient/RoutingBaseTest.php | 1 + .../anime-completed-transformed.json | 2 +- 31 files changed, 876 insertions(+), 179 deletions(-) create mode 100644 app/views/anime/add.php create mode 100644 src/Aviat/Ion/Enum/MessageType.php diff --git a/app/bootstrap.php b/app/bootstrap.php index 8b9d1571..eaec9c1d 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -74,7 +74,7 @@ return function(array $config_array = []) { // Miscellaneous helper methods $anime_client = new AnimeClient(); $anime_client->setContainer($container); - $container->set('anime_client', $anime_client); + $container->set('anime-client', $anime_client); // Models $container->set('api-model', new Model\API($container)); diff --git a/app/config/minify_js_groups.php b/app/config/minify_js_groups.php index e39a7af3..f1f1c932 100644 --- a/app/config/minify_js_groups.php +++ b/app/config/minify_js_groups.php @@ -36,6 +36,14 @@ return [ 'anime_edit.js', 'manga_edit.js' ], + 'table_edit' => [ + 'lib/jquery.min.js', + 'lib/table_sorter/jquery.tablesorter.min.js', + 'sort_tables.js', + 'show_message.js', + 'anime_edit.js', + 'manga_edit.js' + ], 'anime_collection' => [ 'lib/jquery.min.js', 'lib/jquery.throttle-debounce.js', diff --git a/app/config/routes.php b/app/config/routes.php index d75c8b4e..9118ee45 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -18,18 +18,22 @@ return [ 'default_method' => 'index', '404_method' => 'not_found' ], - // Routes on all controllers - 'common' => [ - 'update' => [ - 'path' => '/{controller}/update', - 'action' => 'update', - 'verb' => 'post', - 'tokens' => [ - 'controller' => '[a-z_]+' - ] - ], - ], // Routes on anime collection controller + 'anime' => [ + 'anime_add_form' => [ + 'path' => '/anime/add', + 'action' => 'add_form', + 'verb' => 'get' + ], + 'anime_add' => [ + 'path' => '/anime/add', + 'action' => 'add', + 'verb' => 'post' + ] + ], + 'manga' => [ + + ], 'collection' => [ 'collection_search' => [ 'path' => '/collection/search', diff --git a/app/views/anime/add.php b/app/views/anime/add.php new file mode 100644 index 00000000..12e88ab3 --- /dev/null +++ b/app/views/anime/add.php @@ -0,0 +1,40 @@ +is_authenticated()): ?> +
+

Add Anime to your List

+
+
+ +
+
+
+
+ + + + + + + + + + + +
+ +
  + +
+
+
+ + + \ No newline at end of file diff --git a/app/views/anime/cover.php b/app/views/anime/cover.php index bcc216f1..c9fedca0 100644 --- a/app/views/anime/cover.php +++ b/app/views/anime/cover.php @@ -1,4 +1,7 @@
+is_authenticated()): ?> +Add Item +

There's nothing here!

@@ -7,18 +10,35 @@

html($name) ?>

+ is_authenticated()) continue; ?>
is_authenticated()): ?> - + img($item['anime']['image']); ?>
+ is_authenticated()): ?> +
+ + ">Edit + +
+ + +
+ + + + + +
+
Rating: / 10
Episodes: diff --git a/app/views/anime/edit.php b/app/views/anime/edit.php index fe128b54..3c44d7b3 100644 --- a/app/views/anime/edit.php +++ b/app/views/anime/edit.php @@ -1,8 +1,89 @@ - - +is_authenticated()): ?>
+

Edit Anime List Item

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

html($item['anime']['title']) ?>

+ +

html($item['anime']['alternate_title']) ?>

+ +
+
+ img($item['anime']['image']); ?> +
+
+ checked="checked" + /> +
+ +
+ / 10 +
+ + 0): ?> + / + +
+ checked="checked" + /> +
+ +
+ +
  + + + +
- - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/anime/list.php b/app/views/anime/list.php index e8b0343e..804fa490 100644 --- a/app/views/anime/list.php +++ b/app/views/anime/list.php @@ -1,4 +1,7 @@
+is_authenticated()): ?> +Add Item +

There's nothing here!

@@ -7,21 +10,31 @@ + is_authenticated()): ?> + + + + is_authenticated()) continue; ?> + is_authenticated()): ?> + + - + - - + + @@ -47,4 +70,5 @@ - \ No newline at end of file +is_authenticated()) ? 'table_edit' : 'table' ?> + diff --git a/app/views/collection/add.php b/app/views/collection/add.php index 3ff15a21..d8fb65f2 100644 --- a/app/views/collection/add.php +++ b/app/views/collection/add.php @@ -1,37 +1,43 @@ is_authenticated()): ?>
+

Add Anime to your Collection

-
-
Series
-
-
+
+
-
- -
-
- -
- -
-
- -
 
-
- -
-
+ +
+
  Title Airing Status Score Type Progress RatedAttributes Notes Genres
+ ">Edit + - + " . $item['anime']['alternate_title'] : "" ?> @@ -29,16 +42,26 @@ / 10 Episodes: / + Episodes:
+  /  +
-
    - - -
  • +
+ + + + + - + + +

html($item['notes']) ?>

+
+ +
+ + + + + + + + + + + + + + +
+ +
  + +
diff --git a/app/views/collection/cover.php b/app/views/collection/cover.php index bd154cf7..3dafcbf0 100644 --- a/app/views/collection/cover.php +++ b/app/views/collection/cover.php @@ -1,6 +1,6 @@
is_authenticated()): ?> -[Add Item] +Add Item

There's nothing here!

@@ -19,17 +19,17 @@
+ is_authenticated()): ?> +
+ ">Edit + ">Delete */ ?> +
+
Episodes:
- is_authenticated()): ?> -
- [">Edit] - [">Delete] -
-
diff --git a/app/views/collection/edit.php b/app/views/collection/edit.php index fd6bf1c6..8afecb81 100644 --- a/app/views/collection/edit.php +++ b/app/views/collection/edit.php @@ -1,30 +1,49 @@ is_authenticated()): ?>
+

Edit Anime Collection Item

-
-

-

- -
-
- -
- -
-
- -
 
-
- - - - -
-
+ + + + + + + + + + + + + + + + + + + + + +
+

html($item['title']) ?>

+ +

html($item['alternate_title']) ?>

+ +
+
+ img($item['cover_image']); ?> +
+
+ +
  + + + + +