Browse Source

Merge branch 'master' of git.raylu.net:otakuhub

Michael Francis 14 years ago
parent
commit
dd531d3928

+ 5 - 7
controllers/AnimeController.php

@@ -19,15 +19,13 @@ class AnimeController extends \lithium\action\Controller {
 		if (is_numeric($id))
 		{
 			$data = Anime::search($id, null, 'special_id');
-			$related = $data['anime']->related;
-			$str = '';
-			for ($i = 0; $i < count($related); $i++)
+			$related = Array();
+			foreach ($data['anime']->related as $rid)
 			{
-				if ($i > 0) $str .= ', ';
-				$ra = Anime::search($related[$i], null, 'special_id');
-				$str .= '<a href="' . $related[$i] . '">' . $ra['anime']->title .  '</a>';
+				$ra = Anime::search($rid, null, 'special_id');
+				$related[$ra['anime']->title] = $rid;
 			}
-			$data['related'] = $str;
+			$data['related'] = $related;
 			return $data;
 		}
 		else

+ 1 - 1
views/anime/index.html.php

@@ -1,5 +1,5 @@
 <?php
-$this->styles($this->html->style('anime'));
+$this->styles($this->html->style('table'));
 $this->styles($this->html->style('pagination'));
 ?>
 

+ 42 - 29
views/anime/view.html.php

@@ -48,8 +48,49 @@ for ($i = 0; $i < count($anime->genres); $i++) {
 } ?><?= $str ?><br>
 <b>Duration:</b> <?= $anime->episode_duration ?><br>
 <b>Rating:</b> <?= $anime->rated ?><br>
-<b>Related:</b> <?= $related ?>
+<b>Related:</b> <?php
+$str = '';
+$keys = array_keys($related);
+for ($i = 0; $i < count($keys); $i++) {
+	if ($i > 0) $str .= ',';
+	$str .= ' <a href="/anime/view/' . $related[$keys[$i]] . '">' . $keys[$i] . '</a>';
+} ?><?= $str ?>
 </p>
+
+<p>
+<a href="/animelist/add/<?= $anime->special_id ?>" id="add">Add</a>
+</p>
+
+<?php if (count($anime->cast) > 1): // why is this 1? ?>
+	<section id="cast">
+	<p>
+	<a href="/anime/cast/<?= $anime->special_id ?>" onclick="return toggleCast()">Cast &#x2193;</a>
+	</p>
+	<table>
+	<?php for ($i = 0; $i < count($anime->cast); $i++): ?>
+		<tr<? if ($i > 0) echo ' class="char"' ?>>
+			<td colspan="3">
+				<?= $anime->cast[$i]->character ?>
+			</td>
+		</tr>
+		<?php if (isset($anime->cast[$i]->people)): ?>
+			<?php foreach($anime->cast[$i]->people as $actor): ?>
+				<tr>
+					<td></td>
+					<td><?= $actor->name ?></td>
+					<td><?= $actor->language ?></td>
+				</tr>
+			<?php endforeach; ?>
+		<?php endif; ?>
+	<?php endfor; ?>
+	</table>
+	<br>
+	<p id="castlink">
+	<a href="" onclick="return toggleCast()">Cast &#x2191;</a>
+	</p>
+	</section>
+<?php endif; ?>
+
 </section>
 
 <aside id="malstats">
@@ -63,34 +104,6 @@ for ($i = 0; $i < count($anime->genres); $i++) {
 </p>
 </aside>
 
-<section id="cast">
-<p>
-<a href="/anime/cast/<?= $anime->special_id ?>" onclick="return toggleCast()">Cast &#x2193;</a>
-</p>
-<table>
-<?php for ($i = 0; $i < count($anime->cast); $i++): ?>
-	<tr<? if ($i > 0) echo ' class="char"' ?>>
-		<td colspan="3">
-			<?= $anime->cast[$i]->character ?>
-		</td>
-	</tr>
-	<?php if (isset($anime->cast[$i]->people)): ?>
-		<?php foreach($anime->cast[$i]->people as $actor): ?>
-			<tr>
-				<td></td>
-				<td><?= $actor->name ?></td>
-				<td><?= $actor->language ?></td>
-			</tr>
-		<?php endforeach; ?>
-	<?php endif; ?>
-<?php endfor; ?>
-</table>
-<br>
-<p id="castlink">
-<a href="" onclick="return toggleCast()">Cast &#x2191;</a>
-</p>
-</section>
-
 <br class="cl">
 
 <h2 class="ribbon">Synopsis</h2>

+ 0 - 3
views/anime_list/index.html

@@ -1,3 +0,0 @@
-<h1><?= $user->username ?>'s AnimeList</h1>
-
-<?= print_r($watching); ?>

+ 0 - 74
views/anime_list/index.html.php

@@ -1,74 +0,0 @@
-<h1><?= $user->username ?>'s AnimeList</h1>
-<hr/>
-<table><tr><?= $this->html->link("Completed", "/animelist/view/$user->username/completed"); ?> </tr></table>
-
-<?php if (isset($watching)): ?>
-<h2 class="ribbon">Watching</h2><button value="Add" style="float:right">
-<tr><th>Entry #</th><th>Anime Title</th><th>Score</th><th>Type</th><th>Progress</th></tr>
-<?php $i = 1; ?>
-<?php foreach ($watching as $anime): ?>
-	<tr>
-	<td><?= $i ?></td>
-	<td><?= $anime->series_title ?></td>
-	<td><?= ($anime->my_score != 0) ? $anime->my_score : "-"; ?></td>
-	<td><?= $anime->series_type ?></td>
-	<td><?= $anime->my_watched_episodes ?>/<?= ($anime->series_episodes != 0) ? $anime->series_episodes : "-"; ?></td>
-	</tr>
-<?php $i += 1; ?>
-<?php endforeach; ?>
-</table>
-<?php endif; ?>
-
-<?php if (isset($planning)): ?>
-<h2 class="ribbon">Plans to Watch</h2>
-<table>
-<tr><th>Entry #</th><th>Anime Title</th><th>Score</th><th>Type</th><th>Progress</th></tr>
-<?php $i = 1; ?>
-<?php foreach ($planning as $anime): ?>
-	<tr>
-	<td><?= $i ?></td>
-	<td><?= $anime->series_title ?></td>
-	<td><?= ($anime->my_score != 0) ? $anime->my_score : "-"; ?></td>
-	<td><?= $anime->series_type ?></td>
-	<td><?= $anime->my_watched_episodes ?>/<?= ($anime->series_episodes != 0) ? $anime->series_episodes : "-"; ?></td>
-	</tr>
-<?php $i += 1; ?>
-<?php endforeach; ?>
-</table>
-<?php endif; ?>
-
-<?php if(isset($paused)): ?>
-<h2 class="ribbon">Paused</h2>
-<table>
-<tr><th>Entry #</th><th>Anime Title</th><th>Score</th><th>Type</th><th>Progress</th></tr>
-<?php $i = 1; ?>
-<?php foreach ($paused as $anime): ?>
-	<tr>
-	<td><?= $i ?></td>
-	<td><?= $anime->series_title ?></td>
-	<td><?= ($anime->my_score != 0) ? $anime->my_score : "-"; ?></td>
-	<td><?= $anime->series_type ?></td>
-	<td><?= $anime->my_watched_episodes ?>/<?= ($anime->series_episodes != 0) ? $anime->series_episodes : "-"; ?></td>
-	</tr>
-<?php $i += 1; ?>
-<?php endforeach; ?>
-</table>
-<?php endif; ?>
-
-<?php if (isset($dropped)): ?>
-<h2 class="ribbon">Dropped</h2>
-<table>
-<tr><th>Entry #</th><th>Anime Title</th><th>Score</th><th>Type</th><th>Progress</th></tr>
-<?php $i = 1; ?>
-<?php foreach ($dropped as $anime): ?>
-	<tr>
-	<td><?= $i ?></td>
-	<td><?= $anime->series_title ?></td>
-	<td><?= ($anime->my_score != 0) ? $anime->my_score : "-"; ?></td>
-	<td><?= $anime->series_type ?></td>
-	<td><?= $anime->my_watched_episodes ?>/<?= ($anime->series_episodes != 0) ? $anime->series_episodes : "-"; ?></td>
-	</tr>
-<?php $i += 1; ?>
-<?php endforeach; ?>
-</table>
-<?php endif; ?>

+ 4 - 4
views/pages/home.html.php

@@ -69,13 +69,13 @@ $this->styles($this->html->style("/css/home.css"));
 <h2 class="ribbon">Why you'll &#9825; OtakuHub~</h2>
 <div class="triangle-ribbon"></div>
 <br class="cl" />
-<h3>For Us By Us</h3>
+<h3>For us by us</h3>
 <p>
-	Built by Otakus for Otakus, we know what you want, and we work tirelessly to give it to you.
+	Built by otakus for otakus. We know what you want and we work tirelessly to give it to you.
 </p>
-<h3>Data Portability</h3>
+<h3>Data portability</h3>
 <p>
-	Move your data between AnimePlanet AnimeDB or MAL or export your list for your own records
+	Move your data between AnimePlanet AnimeDB or MAL or export your list for your own records.
 </p>
 <h3>Meet others</h3>
 <p>

+ 1 - 0
webroot/css/search.css

@@ -19,6 +19,7 @@ p.more a {
 	background: -webkit-linear-gradient(top, #ddd, #bbb);
 	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dddddd', endColorstr='#bbbbbb');
 	color: #111;
+	outline: none;
 }
 p.more a:hover {
 	background: #eee;

+ 3 - 2
webroot/css/view.css

@@ -15,7 +15,7 @@ section#cast {
 	float: left;
 	width: 620px;
 }
-section#cast a {
+section#cast a, #add {
 	padding: 4px 7px;
 	border: 1px solid #aaa;
 	-moz-border-radius: 3px;
@@ -26,8 +26,9 @@ section#cast a {
 	background: -webkit-linear-gradient(top, #ddd, #bbb);
 	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dddddd', endColorstr='#bbbbbb');
 	color: #111;
+	outline: none;
 }
-section#cast a:hover {
+section#cast a:hover, #add:hover {
 	background: #eee;
 	background: -moz-linear-gradient(top, #eee, #ccc);
 	background: -webkit-linear-gradient(top, #eee, #ccc);

+ 6 - 6
webroot/js/functions.js

@@ -18,14 +18,14 @@ jQuery(document).ready(function($) {
 
 function toggleCast() {
 	var table = $('#cast table');
-	if (table.css('display') == 'block') {
-		table.css('display', 'none');
-		$('#cast > p > a').text('Cast ↓');
-		$('#castlink').css('display', 'none');
-	} else {
-		table.css('display', 'block');
+	if (table.css('display') == 'none') {
+		table.show(500);
 		$('#cast > p > a').text('Cast ↑');
 		$('#castlink').css('display', 'block');
+	} else {
+		table.hide(500);
+		$('#cast > p > a').text('Cast ↓');
+		$('#castlink').css('display', 'none');
 	}
 	return false;
 }