refactor sidebar and finish migration of notes

This commit is contained in:
Reinier Balt 2010-11-24 22:01:23 +01:00
parent 94b5aa2346
commit ea1ca130f1
18 changed files with 138 additions and 97 deletions

View file

@ -246,4 +246,21 @@ module ApplicationHelper
note = Sanitize.clean(note, Sanitize::Config::RELAXED)
return note
end
def sidebar_html_for_titled_list (list, title)
return content_tag(:h3, title+" (#{list.length})") +
content_tag(:ul, sidebar_html_for_list(list))
end
def sidebar_html_for_list(list)
if list.empty?
return content_tag(:li, t('sidebar.list_empty'))
else
return list.inject("") do |html, item|
link = (item.class == "Project") ? link_to_project( item ) : link_to_context(item)
html << content_tag(:li, link + " (" + count_undone_todos_phrase(item,"actions")+")")
end
end
end
end