Эх сурвалжийг харах

get rid of separate nav elements

raylu 14 жил өмнө
parent
commit
1ce0c23825

+ 0 - 23
views/elements/authnav.html.php

@@ -1,23 +0,0 @@
-<nav>
-<ul id="nav">
-	<li class="current"><a href="/users/feed">Home</a></li>
-	<li><a href="about.html">Anime</a></li>
-	<li><a href="/animelist/view/<?= $user['username'] ?>">My List</a></li>
-	<li><a href="#">Manga</a></li>
-	<li><a href="#">Friends</a></li>
-	<li><a href="/users/settings">Settings</a></li>
-	<li><a href="/logout">Logout</a></li>
-</ul>
-</nav>
-
-<?= $this->form->create(null, array('url' => '/search/index/anime', 'class' => 'search', 'method' => 'get')); ?>
-<?= $this->form->text('search', array('value' => 'Search...', 'onFocus' => 'clearDefault(this)', 'style' => 'width: 200px')); ?>
-<input type="submit" value="Go">
-<?= $this->form->end(); ?>
-
-<div id="friend" style="display:none">
-	<?= $this->form->create(); ?>
-	<?= $this->form->field('username', array('type' => 'textbox')); ?>
-	<?= $this->form->submit('Add'); ?>
-	<?= $this->form->end(); ?>
-</div>

+ 0 - 24
views/elements/normalnav.html.php

@@ -1,24 +0,0 @@
-<nav>
-<ul id="nav">
-	<li class="current"><a href="/users/feed">Home</a></li>
-	<li><a href="about.html">Anime</a></li>
-    <li><a href="about.html">Manga</a></li>
-	<li><a href="portfolio.html">Stuff</a>
-	<li><a href="contact.html">Contact Us</a></li>
-	<li><a href="#login" rel="prettyPhoto">Login</a></li>
-</ul>
-</nav>
-
-<?= $this->form->create(null, array('url' => '/search/index/anime', 'class' => 'search', 'method' => 'get')); ?>
-<?= $this->form->text('search', array('value' => 'Search...', 'onFocus' => 'clearDefault(this)', 'style' => 'width: 200px')); ?>
-<input type="submit" value="Go">
-<?= $this->form->end(); ?>
-
-<div id="login" style="display: none;">
-<h2>Login</h2>
-	<?= $this->form->create(null, array('url' => '/login', 'id' => 'login')); ?>
-	<?= $this->form->field('username', array('type' => 'textbox')); ?>
-	<?= $this->form->field('password', array('type' => 'password')); ?>
-	<?= $this->form->submit('Login'); ?>
-	<?= $this->form->end(); ?>
-</div>

+ 41 - 2
views/layouts/default.html.php

@@ -27,16 +27,55 @@ use \lithium\security\Auth;
 </head>
 <header>
 	<?php
+	$links = array(
+		'Home' => '/',
+		'Anime' => '/anime',
+		'Manga' => '/manga',
+	);
 	$user = Auth::check('default');
 	if ($user)
 	{
-		echo $this->_render('element', 'authnav', compact('user'));
+		$links['Feed'] = '/users/feed';
+		$links['Profile'] = '/users/feed';
+		$links['Logout'] = '/logout';
 	}
 	else
 	{
-		echo $this->_render('element', 'normalnav', compact('user'));
+		$links['Sign up'] = '/users/signup';
+		$links['Login'] = '#login';
+		echo '
+		<div id="login" style="display: none">
+		<h2>Login</h2>
+		';
+		echo $this->form->create(null, array('url' => '/login', 'id' => 'login'));
+		echo $this->form->field('username', array('type' => 'textbox'));
+		echo $this->form->field('password', array('type' => 'password'));
+		echo $this->form->submit('Login');
+		echo $this->form->end();
+		echo '</div>';
 	}
+	echo '
+	<nav>
+	<ul>
+	';
+	foreach ($links as $name => $path) {
+		if ($path == '/')
+			echo '<li class="current">';
+		else
+			echo '<li>';
+		echo "<a href=\"$path\">$name</a></li>";
+	}
+	echo '
+	</ul>
+	</nav>
+	';
 	?>
+
+	<?= $this->form->create(null, array('url' => '/search/index/anime', 'class' => 'search', 'method' => 'get')); ?>
+	<?= $this->form->text('search', array('value' => 'Search...', 'onFocus' => 'clearDefault(this)', 'style' => 'width: 200px')); ?>
+	<input type="submit" value="Go">
+	<?= $this->form->end(); ?>
+
 	<br class="cl" />
 </header>
 <div id="page">

+ 7 - 10
webroot/css/base.css

@@ -194,20 +194,19 @@ img.fr {
 nav {
 	float: left;
 }
-#nav {
+nav ul {
 	line-height: 100%;
 	margin: 0 auto;
 	padding: 10px;
 	width: 100%;
 }
-#nav li {
+nav ul li {
 	display: inline-block;
 	list-style: none;
 	z-index: 100;
 	margin-left: 15px;
 }
-/* main level link */
-#nav a {
+nav a {
 	font-weight: bold;
 	text-decoration: none;
 	display: block;
@@ -216,12 +215,11 @@ nav {
 	-webkit-border-radius: 3px;
 	-moz-border-radius: 3px;
 }
-#nav a:hover {
+nav a:hover {
 	background: #000;
 	color: #000;
 }
-/* main level link hover */
-#nav .current a, #nav li:hover > a {
+nav .current a, nav li:hover > a {
 	background: #e5e5e5;
 	color: #444;
 	border-top: solid 1px #cccccc;
@@ -231,14 +229,13 @@ nav {
 	padding:7px 11px 8px;
 	text-shadow:0 1px 0 #FFFFFF;
 }
-/* rounded corners of first and last link */
-#nav ul li:first-child > a {
+nav ul li:first-child > a {
 	-webkit-border-top-left-radius: 3px;
 	-moz-border-radius-topleft: 3px;
 	-webkit-border-top-right-radius: 3px;
 	-moz-border-radius-topright: 3px;
 }
-#nav ul li:last-child > a {
+nav ul li:last-child > a {
 	-webkit-border-bottom-left-radius: 3px;
 	-moz-border-radius-bottomleft: 3px;
 	-webkit-border-bottom-right-radius: 3px;