From c50b1da53be75c1a63475c8d9e06f825638b3d32 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 31 Mar 2017 16:36:22 -0400 Subject: [PATCH] Details and user page updates, resolves #27 --- app/views/anime/details.php | 16 ++++----- app/views/character.php | 2 +- app/views/manga/details.php | 17 +++++---- app/views/me.php | 71 ++++++++++++++++++++++++++++++------- public/css/base.css | 66 ++++++++++++++++++++++++++++++---- public/css/base.myth.css | 60 +++++++++++++++++++++++++++---- src/API/Kitsu/Model.php | 6 ++++ src/Controller.php | 11 ++++++ src/Controller/Index.php | 11 ------ 9 files changed, 205 insertions(+), 55 deletions(-) diff --git a/app/views/anime/details.php b/app/views/anime/details.php index ea209ab0..eea521c2 100644 --- a/app/views/anime/details.php +++ b/app/views/anime/details.php @@ -76,25 +76,25 @@ -
+ 0): ?>

Characters

-
+
-
+
+ -
-
+ \ No newline at end of file diff --git a/app/views/character.php b/app/views/character.php index 668a99ff..41a63087 100644 --- a/app/views/character.php +++ b/app/views/character.php @@ -1,7 +1,7 @@
- +

diff --git a/app/views/manga/details.php b/app/views/manga/details.php index c883706e..a4dbf48d 100644 --- a/app/views/manga/details.php +++ b/app/views/manga/details.php @@ -35,26 +35,25 @@

-
+ 0): ?>

Characters

-
+
-
+
+ -
-
- +
\ No newline at end of file diff --git a/app/views/me.php b/app/views/me.php index fc08198b..24c6b8f7 100644 --- a/app/views/me.php +++ b/app/views/me.php @@ -1,4 +1,5 @@ -
+ +

@@ -54,29 +55,73 @@
html($attributes['bio']) ?>
-

Favorites:

-
-

Characters

-
+

Favorite Characters

+
-
+
+ -
+
+ + +

Favorite Anime

+
+ +
+ generate('anime.details', ['id' => $anime['slug']]); + $titles = Kitsu::filterTitles($anime); + ?> + + + + +
+ +
+ + +

Favorite Manga

+
+ +
+ generate('manga.details', ['id' => $manga['slug']]); + $titles = Kitsu::filterTitles($manga); + ?> + + + + +
+
+ +
\ No newline at end of file diff --git a/public/css/base.css b/public/css/base.css index de39c8b9..a003688e 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -1025,7 +1025,7 @@ a:hover, a:active { Base list styles ------------------------------------------------------------------------------*/ -.media { +.media, .character, .small_character { position:relative; vertical-align:top; display:inline-block; @@ -1035,7 +1035,9 @@ a:hover, a:active { margin:0.25em 0.125em; } -.media > img { +.media > img, +.character > img, +.small_character > img { width: 100%; } @@ -1076,7 +1078,9 @@ a:hover, a:active { top: 0; } -.media:hover > .name, +.small_character:hover > .name, + .character:hover > .name, + .media:hover > .name, .media:hover > .media_metadata > div, .media:hover > .medium_metadata > div, .media:hover > .table .row @@ -1094,7 +1098,11 @@ a:hover, a:active { display:block; } -.media > .name a, +.small_character > .name a, + .small_character > .name a small, + .character > .name a, + .character > .name a small, + .media > .name a, .media > .name a small { background:none; @@ -1263,7 +1271,7 @@ a:hover, a:active { .details .cover { display: block; width: 284px; - height: 402px; + /* height: 402px; */ } .details h2 { @@ -1298,12 +1306,56 @@ a:hover, a:active { text-align:left; } +.character, +.small_character { + background: rgba(0, 0, 0, .5); + width: 225px; + height: 350px; + vertical-align: middle; + white-space: nowrap; +} + +.small_character a { + display:inline-block; + width: 100%; + height: 100%; + } + +.small_character .name, + .character .name { + position: absolute; + bottom: 0; + left: 0; + z-index: 10; + } + +.small_character img, + .character img { + position: relative; + top: 50%; + -webkit-transform: translateY(-50%); + transform: translateY(-50%); + z-index: 5; + width: 100%; + } + /* ---------------------------------------------------------------------------- User page styles -----------------------------------------------------------------------------*/ -.small_character img { - max-width: 300px; +.small_character { + width: 160px; + height: 250px; +} + +.user-page .media-wrap { + text-align: left; +} + +.media a { + display: inline-block; + width: 100%; + height: 100%; } /* ---------------------------------------------------------------------------- diff --git a/public/css/base.myth.css b/public/css/base.myth.css index 679eb3df..60fae728 100644 --- a/public/css/base.myth.css +++ b/public/css/base.myth.css @@ -297,7 +297,7 @@ a:hover, a:active { Base list styles ------------------------------------------------------------------------------*/ -.media { +.media, .character, .small_character { position:relative; vertical-align:top; display:inline-block; @@ -307,7 +307,9 @@ a:hover, a:active { margin: var(--normal-padding); } -.media > img { +.media > img, +.character > img, +.small_character > img { width: 100%; } @@ -347,7 +349,8 @@ a:hover, a:active { position:absolute; top: 0; } - + .small_character:hover > .name, + .character:hover > .name, .media:hover > .name, .media:hover > .media_metadata > div, .media:hover > .medium_metadata > div, @@ -364,6 +367,10 @@ a:hover, a:active { display:block; } + .small_character > .name a, + .small_character > .name a small, + .character > .name a, + .character > .name a small, .media > .name a, .media > .name a small { @@ -521,7 +528,7 @@ a:hover, a:active { .details .cover { display: block; width: 284px; - height: 402px; + /* height: 402px; */ } .details h2 { @@ -552,13 +559,54 @@ a:hover, a:active { text-align:left; } +.character, +.small_character { + background: rgba(0,0,0,0.5); + width: 225px; + height: 350px; + vertical-align: middle; + white-space: nowrap; +} + .small_character a { + display:inline-block; + width: 100%; + height: 100%; + } + + .small_character .name, + .character .name { + position: absolute; + bottom: 0; + left: 0; + z-index: 10; + } + + .small_character img, + .character img { + position: relative; + top: 50%; + transform: translateY(-50%); + z-index: 5; + width: 100%; + } + /* ---------------------------------------------------------------------------- User page styles -----------------------------------------------------------------------------*/ -.small_character img { - max-width: 300px; +.small_character { + width: 160px; + height: 250px; } +.user-page .media-wrap { + text-align: left; +} + +.media a { + display: inline-block; + width: 100%; + height: 100%; +} /* ---------------------------------------------------------------------------- Viewport-based styles diff --git a/src/API/Kitsu/Model.php b/src/API/Kitsu/Model.php index cc7f80ea..db34552a 100644 --- a/src/API/Kitsu/Model.php +++ b/src/API/Kitsu/Model.php @@ -433,6 +433,12 @@ class Model { ] ]; $data = $this->getRequest("anime/{$kitsuAnimeId}", $options); + + if ( ! array_key_exists('included', $data)) + { + return NULL; + } + $mappings = array_column($data['included'], 'attributes'); foreach($mappings as $map) diff --git a/src/Controller.php b/src/Controller.php index 21aea39b..5d655914 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -284,6 +284,17 @@ class Controller { ], NULL, $httpCode); } + /** + * Redirect to the default controller/url from an empty path + * + * @return void + */ + public function redirectToDefaultRoute() + { + $defaultType = $this->config->get(['routes', 'route_config', 'default_list']) ?? 'anime'; + $this->redirect($this->urlGenerator->defaultUrl($defaultType), 303); + } + /** * Set a session flash variable to display a message on * next page load diff --git a/src/Controller/Index.php b/src/Controller/Index.php index 9400e954..b9a9f08f 100644 --- a/src/Controller/Index.php +++ b/src/Controller/Index.php @@ -113,17 +113,6 @@ class Index extends BaseController { ]); } - /** - * Redirect to the default controller/url from an empty path - * - * @return void - */ - public function redirectToDefaultRoute() - { - $defaultType = $this->config->get(['routes', 'route_config', 'default_list']); - $this->redirect($this->urlGenerator->defaultUrl($defaultType), 303); - } - private function organizeFavorites(array $rawfavorites): array { // return $rawfavorites;