Placeholder stylesheets
Now I can look at this.
This commit is contained in:
parent
041b8eedbe
commit
c345800716
6 changed files with 152 additions and 29 deletions
79
public_html/media/css/core.css
Normal file
79
public_html/media/css/core.css
Normal file
|
@ -0,0 +1,79 @@
|
|||
body {
|
||||
background: white;
|
||||
color: black;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: sans-serif;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 0;
|
||||
margin: 1.5em 0.75em;
|
||||
}
|
||||
|
||||
nav {
|
||||
background: #eee;
|
||||
color: black;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
nav li {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
nav li input,
|
||||
nav li a {
|
||||
color: black;
|
||||
display: inline-block;
|
||||
margin-bottom: 3px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
nav li a {
|
||||
padding: 0.2em 0.75em;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
nav li.search {
|
||||
background: white;
|
||||
margin: 0 0.25em;
|
||||
padding: 0.2em 0.5em;
|
||||
}
|
||||
|
||||
nav li a:focus,
|
||||
nav li a:hover {
|
||||
color: firebrick;
|
||||
border-bottom: 3px solid firebrick;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
nav li.search input {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
margin: 0 auto;
|
||||
min-width: 700px;
|
||||
width: 80%;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
/* small screens */
|
||||
@media (max-width: 699px), (max-device-width: 699px) {
|
||||
.main-wrapper {
|
||||
min-width: 0;
|
||||
width: 95%;
|
||||
max-width: 700px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
|
@ -28,6 +28,8 @@ class Bootstrap
|
|||
session_start();
|
||||
|
||||
$this->context->title = $this->config->main->title;
|
||||
$this->context->stylesheets = ['core.css'];
|
||||
|
||||
$this->context->layoutName = isset($_GET['json'])
|
||||
? 'layout-json'
|
||||
: 'layout-normal';
|
||||
|
|
|
@ -6,6 +6,7 @@ class CommentController
|
|||
*/
|
||||
public function listAction()
|
||||
{
|
||||
$this->context->activeSection = 'comments';
|
||||
$this->context->subTitle = 'comments';
|
||||
throw new Exception('Not implemented');
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ class IndexController
|
|||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->context->activeSection = 'home';
|
||||
$this->context->subTitle = 'home';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,17 @@ class PostController
|
|||
*/
|
||||
public function listAction($query = null)
|
||||
{
|
||||
#redirect requests in form of /posts/?query=... to canonical address
|
||||
$formQuery = InputHelper::get('query');
|
||||
if (!empty($formQuery))
|
||||
{
|
||||
$url = \Chibi\UrlHelper::route('post', 'list', ['query' => $formQuery]);
|
||||
\Chibi\UrlHelper::forward($url);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->context->subTitle = 'browsing posts';
|
||||
$this->context->searchQuery = $query;
|
||||
throw new Exception('Not implemented');
|
||||
}
|
||||
|
||||
|
@ -29,4 +39,12 @@ class PostController
|
|||
$this->context->subTitle = 'showing @' . $id;
|
||||
throw new Exception('Not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* @route /favorites
|
||||
*/
|
||||
public function favoritesAction()
|
||||
{
|
||||
$this->listAction('favmin:1');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,41 +7,63 @@
|
|||
<?php else: ?>
|
||||
<title><?php echo $this->context->title ?></title>
|
||||
<?php endif ?>
|
||||
<?php foreach ($this->context->stylesheets as $name): ?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>" />
|
||||
<?php endforeach ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('index', 'index') ?>">Home</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>">Browse</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('comment', 'list') ?>">Comments</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => 'favmin:1']) ?>">Favorites</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('user', 'show', ['name' => $this->context->user->name]) ?>">Account</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('post', 'upload') ?>">Upload</a></li>
|
||||
<li>
|
||||
<form action="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
|
||||
<input type="search" name="query" placeholder="search…">
|
||||
<input type="submit" name="submit" value="Go">
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<?php if (!$this->context->loggedIn): ?>
|
||||
<a href="<?php echo \Chibi\UrlHelper::route('auth', 'login') ?>">Login</a>
|
||||
or
|
||||
<a href="<?php echo \Chibi\UrlHelper::route('auth', 'register') ?>">register</a>
|
||||
<?php else: ?>
|
||||
<?php echo $this->context->user->name ?>
|
||||
|
||||
<a href="<?php echo \Chibi\UrlHelper::route('auth', 'logout') ?>">
|
||||
Logout
|
||||
</a>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="main-wrapper">
|
||||
<ul>
|
||||
<?php
|
||||
$preNav = [];
|
||||
$postNav = [];
|
||||
|
||||
$preNav []= ['Home', \Chibi\UrlHelper::route('index', 'index')];
|
||||
$preNav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')];
|
||||
$preNav []= ['Comments', \Chibi\UrlHelper::route('comment', 'list')];
|
||||
$preNav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];
|
||||
$preNav []= ['Upload', \Chibi\UrlHelper::route('post', 'upload')];
|
||||
if (!$this->context->loggedIn)
|
||||
{
|
||||
$postNav []= ['Login', \Chibi\UrlHelper::route('auth', 'login')];
|
||||
$postNav []= ['Register', \Chibi\UrlHelper::route('auth', 'register')];
|
||||
}
|
||||
else
|
||||
{
|
||||
$postNav []= ['Account', \Chibi\UrlHelper::route('user', 'show', ['name' => $this->context->user->name])];
|
||||
$postNav []= ['Logout', \Chibi\UrlHelper::route('auth', 'logout')];
|
||||
}
|
||||
|
||||
function printNav($nav)
|
||||
{
|
||||
foreach ($nav as $navItem)
|
||||
{
|
||||
list ($text, $link) = $navItem;
|
||||
echo '<li>';
|
||||
echo '<a href="' . $link . '">' . $text . '</a>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php printNav($preNav); ?>
|
||||
<li class="search">
|
||||
<form action="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
|
||||
<input type="search" name="query" placeholder="search…" value="<?php if (isset($this->context->searchQuery)) echo $this->context->searchQuery ?>">
|
||||
</form>
|
||||
</li>
|
||||
<?php printNav($postNav); ?>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<section>
|
||||
<?php echo $this->renderView() ?>
|
||||
<section id="content">
|
||||
<div class="main-wrapper">
|
||||
<?php echo $this->renderView() ?>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue