always show article list on blog pages

This commit is contained in:
Sami Samhuri 2011-11-27 20:26:42 -08:00
parent 1e6d95d137
commit 0f3917b3df
4 changed files with 52 additions and 43 deletions

View file

@ -34,9 +34,19 @@
$('#comments').html(h) $('#comments').html(h)
}) })
} }
jQuery(function($) { jQuery(function($) {
var hidden = true
, index = $('#index')
$('#index-toggle').click(function() {
index.toggle()
hidden = !hidden
$(this).html(hidden ? '↓ show posts ↓' : '↑ hide posts ↑')
})
$('#need-js').remove() $('#need-js').remove()
console.dir($('#need-js'))
SJS.request({uri: countCommentsURL(SJS.filename)}, function(err, request, body) { SJS.request({uri: countCommentsURL(SJS.filename)}, function(err, request, body) {
if (err) return if (err) return

View file

@ -66,7 +66,8 @@ class Blag
page_template = File.read(File.join('templates', 'blog', 'post.html')) page_template = File.read(File.join('templates', 'blog', 'post.html'))
posts.each_with_index do |post, i| posts.each_with_index do |post, i|
template = post[:link] ? link_template : post_template template = post[:link] ? link_template : post_template
values = { :title => post[:title], values = { :posts => posts,
:title => post[:title],
:link => post[:link], :link => post[:link],
:article => Mustache.render(template, post), :article => Mustache.render(template, post),
:previous => i < posts.length - 1 && posts[i + 1], :previous => i < posts.length - 1 && posts[i + 1],

View file

@ -79,16 +79,6 @@ _gaq.push( ['_setAccount', 'UA-214054-5']
var s = document.getElementsByTagName('script')[0] var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(ga, s) s.parentNode.insertBefore(ga, s)
}()) }())
jQuery(function($) {
var hidden = true
, index = $('#index')
$('#index-toggle').click(function() {
index.toggle()
hidden = !hidden
$(this).html(hidden ? '&darr; show posts &darr;' : '&uarr; hide posts &uarr;')
})
})
</script> </script>
{{#comments}} {{#comments}}
<script> <script>

View file

@ -13,6 +13,14 @@
<header> <header>
<h1><a href="index.html">sjs' blog</a></h1> <h1><a href="index.html">sjs' blog</a></h1>
</header> </header>
<div id="show-posts" class="center"><a id="index-toggle" href="#">&darr; show posts &darr;</a></div>
<nav id="index" class="hidden">
<ul>
{{#posts}}
<li><a href="{{url}}">{{title}}</a> <span class="date">{{date}}</span></li>
{{/posts}}
</ul>
</nav>
{{{article}}} {{{article}}}
<div id="around"> <div id="around">
{{#previous}} {{#previous}}