% @title = "ToDo" %>
<%= sub_template "top" %>
<% num_items = @todo_items.inject(0) { |n, (p,i)| n += i.size }
num_items += @bliki_todo_items.inject(0) { |n, (p,i)| n += i.size }
%>
There <%= num_items == 1 ? 'is' : 'are' %> <%= num_items.zero? ? "no" : num_items %> ToDo item<%= num_items != 1 ? 's' : '' %>.
<% today = Date.today
@todo_items.each do |page, items| %>
- <%= page.link %>
<% items.each do |item|
# default is the muted 'darkred', to prevent to many bright red
# items on one page: (See also chunks/todo.rb)
tclass = "todoFuture"
# next check is the item is dated:
d = ParseDate.parsedate(item[0]) rescue nil
if not d.nil? and not d.all? { |x| x.nil? }
# there's a date in the todo. display it accordingly
d[0] ||= today.year # make sure there's a 'year' component
d = Date.new(*d[0..2]) rescue nil
tclass = 'todo' if (not d.nil?) and ((today <=> d) > -1)
end %>
- <%= item %>
<% end %>
<% end %>
<% if @bliki_todo_items.size > 0 %>
ToDo items from Bliki:
<% @bliki_todo_items.each do |page, items| %>
- <%= link_to_bliki(page) %>
<% items.each do |item|
# default is the muted 'darkred', to prevent to many bright red
# items on one page: (See also chunks/todo.rb)
tclass = "todoFuture"
# next check is the item is dated:
d = ParseDate.parsedate(item[0]) rescue nil
if not d.nil? and not d.all? { |x| x.nil? }
# there's a date in the todo. display it accordingly
d[0] ||= today.year # make sure there's a 'year' component
d = Date.new(*d[0..2]) rescue nil
tclass = 'todo' if (not d.nil?) and ((today <=> d) > -1)
end %>
- <%= item %>
<% end %>
<% end %>
<% end %>
<% if num_items == 0 %>
To make ToDo items appear here insert a 'todo' item in any page. Simply write at the start of any line 'todo' followed by a colon (':'), followed by a space and some text. For example:
todo: some text
This text will be rendered in red on the page itself, and will also appear here in a list of todo items from all the pages.
This module also uses ParseDate, which is a fairly smart module. If you write a date anywhere in the todo item's text, it will be picked up. If that date is today or in the past, the item will be colored bright red!
<% end %>
<%= sub_template "bottom" %>