mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
always show article list on blog pages
This commit is contained in:
parent
1e6d95d137
commit
0f3917b3df
4 changed files with 52 additions and 43 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
3
blog.rb
3
blog.rb
|
|
@ -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],
|
||||||
|
|
|
||||||
|
|
@ -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 ? '↓ show posts ↓' : '↑ hide posts ↑')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
{{#comments}}
|
{{#comments}}
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
|
|
@ -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="#">↓ show posts ↓</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}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue