Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def render_articles_by_date(articles)
- s = ""
- year = ""
- month = ""
- year_started = false
- month_started = false
- s = s + "<div id='archive'>"
- for article in articles
- #
- if year != article.created_at.year.to_s then
- if year_started then
- if month_started then
- s = s + "</ul>"
- end
- s = s + "</li>"
- s = s + "</ul>"
- end
- year_started = true
- month_started = false
- year = article.created_at.year.to_s
- s = s + "<h2>" + year + "</h2>"
- s = s + "<ul>"
- s = s + "<li>"
- end
- #
- if month != article.created_at.month.to_s then
- if month_started then
- s = s + "</ul>"
- end
- month_started = true
- month = article.created_at.month.to_s
- s = s + "<h3>" + article.created_at.strftime("%B") + "</h3>"
- s = s + "<ul>"
- end
- #
- s = s + "<li>"
- #
- s = s + get_article_bullet(article.article_type)
- #
- s = s + article.created_at.day.to_s + "<sup>" + get_day_suffix(article.created_at.day) + "</sup> "
- if article.project.id > 1 then
- s = s + article.project.name + ": "
- end
- s = s + link_to_article(article)
- s = s + "</li>"
- end
- #
- if month_started then
- s = s + "</ul>"
- end
- if year_started then
- s = s + "</li>"
- s = s + "</ul>"
- end
- #
- s = s + "</div>"
- return s
- end
Add Comment
Please, Sign In to add comment