# blog_helper.rb - a sample script for Ruby on Rails # # Copyright (C) 2005 Masao Mutoh # # This file is distributed under the same license as Ruby-GetText-Package. # # BlogHelper is bound a textdomain which is bound in application.rb or # blog_controller.rb. # So you don't need to call bindtextdomain here. # module BlogHelper def show_article(article, show_link = true) ret = %Q[

#{article["title"]} (#{article["lastupdate"]})

#{article["description"]}
] if show_link ret += %Q[

#{link_to(_("Show"), :action => 'show', :id => article)}

] end ret end def show_list(articles) ret = "" articles.each_with_index do |article, index| ret << %Q[
  • #{article["lastupdate"]}: #{link_to((h article["title"]), :action => 'show', :id => article)}
  • ] break if index > 9 end ret end def show_navigation articles = BlogController.new.list %Q[ ] end end