wezm.net/layouts/articles.html
2010-06-30 17:56:37 +10:00

64 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<%= render '_head' %>
<script src="/js/jquery.quicksand.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function() {
function search_handler(e) {
var input = $(this);
var value = input.val();
// var q = (value + String.fromCharCode(e.which)).toLowerCase();
var q = value.toLowerCase();
$('#articles li').filter(function(i) {
var article = $(this);
return article.text().toLowerCase().indexOf(q) < 0;
}).animate({height: 0, opacity: 0}, {queue: false, duration: 500});
}
$('#search').show();
$('#search input').keypress(search_handler).change(search_handler).focus();
});
</script>
</head>
<body class="articles">
<%= render '_header' %>
<div id="content">
<h1>Archives</h1>
<%
menu = [
['All', sorted_articles.size],
['Technical', technical_articles.size],
['Personal', personal_articles.size],
]
%>
<nav class="inline menu">
<% menu.each do |menu_item|
label, count = menu_item
path = (label != "All" ? '/' + label.downcase : '') + "/articles/"
feed = 'http://feeds.feedburner.com/wezm'
feed += "-#{label.downcase}" if label != "All"
active = (@item.identifier.sub(%r{page/$}, '') == path)
%>
<li>
<a href="<%= feed %>"><img class="feed-icon" src="/images/black-feed-icon.png" width="12" height="12" alt="Black Feed Icon" /></a>
<a href="<%= path %>"<%= %Q{class="active"} if active %>><%= label %></a> (<%= count %>)
</li>
<% end %>
<li id="search">
<fieldset>
<label for="query">Search</label>
<input type="search" name="q" id="query" value="" />
</fieldset>
</li>
</nav>
<ul id="articles" class="articles">
<%= yield %>
</ul>
</div>
<%= render '_footer' %>
</body>
</html>