Better main page

This commit is contained in:
Marcin Kurczewski 2013-10-21 09:35:06 +02:00
parent aed60da6f9
commit aab67f4b6c
2 changed files with 57 additions and 66 deletions

View file

@ -1,70 +1,69 @@
#sidebar {
min-width: 100px;
padding: 5em 0;
width: 25%;
margin-right: 5%;
#welcome {
text-align: center;
}
#sidebar p {
#welcome p {
font-size: small;
margin-top: 0;
}
#sidebar p span:not(:last-child):after {
#welcome p span:not(:last-child):after {
content: '\022C5';
margin: 0 0.5em;
}
#sidebar h1 {
#content h1 {
font-size: 26pt;
}
#sidebar input {
width: 100%;
max-width: 300px;
border: 2px solid #ccc;
padding: 5px;
margin-top: 1em;
margin-bottom: 0;
}
#inner-content {
float: right;
#content {
margin: 0 auto;
width: 70%;
min-width: 500px;
position: relative;
}
.small-screen #content {
width: 100%;
min-width: 0;
max-width: 500px;
}
#inner-content .header .tags:before {
#content .header .tags:before {
margin: 0 0.5em;
content: '\2013';
}
#inner-content .header ul {
#content .header ul {
list-style-type: none;
display: inline;
margin: 0;
padding: 0;
}
#inner-content .header li {
#content .header li {
display: inline;
}
#inner-content .header li:not(:last-child) a:after {
#content .header li:not(:last-child) a:after {
content: ', ';
}
#inner-content .body {
#content .body {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAJElEQVQImWNgYGBgePfu3X8YZoABFA6SIqwS+HXgtANZF7IEAJnGPJE70lLLAAAAAElFTkSuQmCC');
margin: 1em 0;
text-align: center;
}
#inner-content .body img {
#content .body img {
max-width: 100%;
margin: 0 auto;
display: block;
}
#inner-content .body a {
#content .body a {
display: block;
}
#inner-content .header .favs-comments {
#content .header .favs-comments {
margin-left: 0.5em;
float: right;
}
#inner-content .footer {
#content .footer {
text-align: right;
}

View file

@ -1,53 +1,45 @@
<div id="sidebar">
<div id="welcome">
<h1><?php echo $this->config->main->title ?></h1>
<form name="search" action="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
<input type="search" name="query" placeholder="Search&hellip;" value="<?php echo isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '' ?>">
</form>
<p>
<span>serving <?php echo $this->context->transport->postCount ?> posts</span>
<span>powered by <a href="<?php echo SZURU_LINK ?>">szurubooru</a></span>
</p>
</div>
<?php if (!empty($this->context->featuredPost)): ?>
<div id="inner-content">
<div class="header">
Featured image
<div class="header">
Featured image
<ul class="tags">
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
<li>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>">
<?php echo $tag->name ?>
</a>
</li>
<?php endforeach ?>
</ul>
<span class="favs-comments">
<?php printf('%d&nbsp;fav%s', $x = $this->context->featuredPost->countOwn('favoritee'), $x == 1 ? '' : 's') ?>,&#32;
<?php printf('%d&nbsp;comment%s', $x = $this->context->featuredPost->countOwn('comment'), $x == 1 ? '' : 's') ?>
</span>
<div class="clear"></div>
</div>
<div class="body">
<a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->featuredPost->id]) ?>">
<img src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $this->context->featuredPost->name]) ?>" alt="<?php echo $this->context->featuredPost->name ?>"/>
</a>
</div>
<div class="footer">
Featured&#32;
<?php if ($this->context->featuredPostUser): ?>
by <a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>"><?php echo $this->context->featuredPostUser->name ?></a>,&#32;
<?php endif ?>
<?php printf('%d day%s', $x = round((time() - $this->context->featuredPostDate) / (24 * 3600.)), $x == 1 ? '' : 's') ?> ago
<div class="clear"></div>
</div>
<ul class="tags">
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
<li>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'list', ['query' => $tag->name]) ?>">
<?php echo $tag->name ?>
</a>
</li>
<?php endforeach ?>
</ul>
<span class="favs-comments">
<?php printf('%d&nbsp;fav%s', $x = $this->context->featuredPost->countOwn('favoritee'), $x == 1 ? '' : 's') ?>,&#32;
<?php printf('%d&nbsp;comment%s', $x = $this->context->featuredPost->countOwn('comment'), $x == 1 ? '' : 's') ?>
</span>
<div class="clear"></div>
</div>
<div class="body">
<a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $this->context->featuredPost->id]) ?>">
<img src="<?php echo \Chibi\UrlHelper::route('post', 'retrieve', ['name' => $this->context->featuredPost->name]) ?>" alt="<?php echo $this->context->featuredPost->name ?>"/>
</a>
</div>
<div class="footer">
Featured&#32;
<?php if ($this->context->featuredPostUser): ?>
by <a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>"><?php echo $this->context->featuredPostUser->name ?></a>,&#32;
<?php endif ?>
<?php printf('%d day%s', $x = round((time() - $this->context->featuredPostDate) / (24 * 3600.)), $x == 1 ? '' : 's') ?> ago
<div class="clear"></div>
</div>
<div class="clear"></div>
<?php endif ?>