Permalink
Browse files

Archive overhaul. Added new views, styles, and sidebar section for ca…

…tegories
  • Loading branch information...
1 parent a1575b0 commit 2fb5683c20f6072d2b96c9ac713298ced711f92f @johanbrook committed Mar 8, 2012
View
@@ -1,41 +0,0 @@
-(function() {
- var hideAddressBar, init, preventAutoscale, scrollToContentOnSingle;
-
- preventAutoscale = function() {
- var viewportmeta;
- viewportmeta = document.querySelector('meta[name="viewport"]');
- if (viewportmeta) {
- viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
- document.body.addEventListener('gesturestart');
- }
- (function() {
- return viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
- });
- return false;
- };
-
- hideAddressBar = function() {
- return setTimeout(function() {
- return scrollTo(0, 1);
- }, 100);
- };
-
- scrollToContentOnSingle = function() {
- var header_height;
- if (document.body.className.match(/single/i)) {
- header_height = document.querySelector('[role="complementary"]').getBoundingClientRect().height;
- return scrollTo(0, header_height);
- }
- };
-
- init = function() {
- if (navigator.userAgent.match(/iPhone/i || navigator.userAgent.match(/iPad/i))) {
- preventAutoscale();
- hideAddressBar();
- return scrollToContentOnSingle();
- }
- };
-
- document.addEventListener("DOMContentLoaded", init, false);
-
-}).call(this);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -26,7 +26,7 @@
$routes = array(
"single" => "posts/single",
"home" => "layouts/home",
- "page('archive')" => "layouts/archive",
+ "page('archive')" => "layouts/posts",
"page('contact')" => "layouts/contact",
"archive" => "layouts/archive",
"page" => "layouts/page",
@@ -93,10 +93,22 @@ h1, h2, h3, h4, h5 {
}
}
+hgroup {
+ margin-bottom: $lineheight;
+ h1 {
+ margin-bottom: 0;
+ }
+}
+
.huge {
@include rem(39);
}
+.sub {
+ @include rem(18);
+ color: $gray;
+}
+
h1 {
@include rem(28);
margin-bottom: 1em;
@@ -82,6 +82,36 @@
list-style: none;
}
+.post-list {
+ @extend .list;
+
+ li {
+ border-bottom: 1px solid #e2e2e2;
+ padding: .3em 0;
+
+ &:last-child{
+ border: 0;
+ }
+
+ &:hover .list-detail {
+ color: #666;
+ }
+ }
+
+ .list-detail {
+ display: inline-block;
+ width: 15%;
+ }
+}
+
+.list-detail {
+ font-family: $sans;
+ color: #999;
+ font-size: .8em;
+ text-transform: uppercase;
+ font-weight: bold;
+}
+
/* Clearfix */
@@ -0,0 +1,10 @@
+.category-list {
+ @include clearfix;
+
+ ul {
+ @extend .columns-two;
+ @include column-rule(0);
+ text-align: left;
+ }
+
+}
@@ -7,6 +7,8 @@
width: $side_col;
margin-right: $spacing;
+ @import "categories";
+
h2 {
@include rem(12);
color: #444;
View
@@ -54,7 +54,10 @@ function get_id_by_slug($page_slug) {
* List posts by month
*/
-function list_posts_by_month($list_class_name){
+function list_posts_by_month($outer_class_name, $inner_class_name=null){
+ if($inner_class_name == null)
+ $inner_class_name = $outer_class_name;
+
// Declare some helper vars
$previous_year = $year = 0;
$previous_month = $month = 0;
@@ -63,7 +66,7 @@ function list_posts_by_month($list_class_name){
// Get the posts
$myposts = get_posts('numberposts=-1&orderby=post_date&order=DESC');
- echo '<ol class="'.$list_class_name.'">';
+ echo '<ol class="'.$outer_class_name.'">';
?>
@@ -92,15 +95,18 @@ function list_posts_by_month($list_class_name){
<h3><?php echo get_the_time($format, $p); ?></h3>
- <ol class="<?php echo $list_class_name;?>">
+ <ol class="<?php echo $inner_class_name;?>">
<?php $ul_open = true; ?>
<?php endif; ?>
<?php $previous_year = $year; $previous_month = $month; ?>
- <li><a rel="bookmark" href="<?php echo get_permalink($p); ?>"><?php echo get_the_title($p); ?></a></li>
+ <li>
+ <small class="list-detail"><?php echo get_the_time("M j, Y", $p->ID);?></small>
+ <a rel="bookmark" href="<?php echo get_permalink($p); ?>"><?php echo get_the_title($p); ?></a>
+ </li>
<?php endforeach; ?>
</ol>
@@ -1,3 +1,26 @@
-<h1>Post archive</h1>
+- global $wp_query
-- list_posts_by_month("list")
+<hgroup>
+- if(is_category()):
+ <h1>
+ = single_cat_title()
+ </h1>
+
+- elseif(is_tag()):
+ <h1>
+ = single_tag_title()
+ </h1>
+- endif;
+ <h2 class="sub"><?php echo $wp_query->post_count;?> posts</h2>
+</hgroup>
+
+<ol class="post-list">
+- if(have_posts()): while(have_posts()): the_post();
+
+ <li>
+ <small class="list-detail"><?php echo the_time("M j, Y");?></small>
+ <a rel="bookmark" href="<?php the_permalink();?>"><?php the_title();?></a>
+ </li>
+
+- endwhile; endif;
+</ol>
@@ -0,0 +1,3 @@
+<h1>Post archive</h1>
+
+- list_posts_by_month("list", "post-list")
@@ -0,0 +1,20 @@
+<?php
+ $categories = get_categories(array("orderby" => "name"));
+?>
+
+- if($categories):
+<section class="category-list">
+ <h2>Categories</h2>
+
+ <ul class="list">
+ - foreach($categories as $c):
+
+ <li <?php if($c->parent) echo 'class="child-category"'; ?>>
+ <a href="<?php echo get_category_link($c->term_id);?>"><?php echo $c->name;?></a>
+ <small class="list-detail"><?php echo $c->category_count;?></small>
+ </li>
+
+ - endforeach;
+ </ul>
+</section>
+- endif;
@@ -29,6 +29,10 @@
</section>
- endif;
+ - if(is_archive() || is_page("archive")):
+ = render_partial("partials/categories")
+ - endif;
+
<section>
<ul class="list links">
<li><h2>Twitter</h2>
@@ -11,5 +11,7 @@
<time datetime="<?php the_time("c");?>" title="<?php echo get_the_time_ago();?>" pubdate><?php the_time("F j");?></time>
= sep()
<a href="<?php the_permalink();?>">Permalink</a>
+ = sep()
+ Read more posts about <?php the_category(" and ", "multiple");?>
</small>
</p>
@@ -1,7 +0,0 @@
-%h2 Archive
-%ul.archive
- - while (have_posts())
- - the_post()
- %li= render_partial("posts/post")
-
-

0 comments on commit 2fb5683

Please sign in to comment.