Sha256: 816b50cfdf23561da17aa2f1be5c0e70743bff955c8112e0ef56ebfd9f11530f

Contents?: true

Size: 1.5 KB

Versions: 22

Compression:

Stored size: 1.5 KB

Contents

# 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[
      <h2>#{article["title"]} (#{article["lastupdate"]})</h2>
      <pre>#{article["description"]}</pre>
    ]
    if show_link
      ret += %Q[<p style="text-align:right;margin-right:3em">#{link_to(_("Show"), :action => 'show', :id => article)}</p>]
    end
    ret
  end

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

  def show_navigation
    articles = BlogController.new.list
    %Q[
<div class="navigation">
<img src="/images/rails.png" width="100" height="100" />
<div class="window">
#{show_language}
</div>
<div class="window">
<h4>] + _("Ruby Links") + %Q[</h4>
<dl>
<li><a href="http://www.ruby-lang.org/">Ruby</a></li>
<li><a href="http://rubyforge.org/projects/gettext/">Ruby-GetText-Package</a></li>
<li><a href="http://wiki.rubyonrails.com/">Ruby on Rails Wiki</a></li>
</dl>
</div>
<div class="window">
<h4>] + _("Old articles") + %Q[</h4>
<p>
<dl>
#{show_list(articles)}
</dl>
</p>
</div>
</div>
    ]
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.9.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.8.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.7.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.6.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.5.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.4.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.3.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.2.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.1.1-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.1.0-mswin32 samples/rails/app/helpers/blog_helper.rb
gettext-1.10.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.1.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.2.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.1.1 samples/rails/app/helpers/blog_helper.rb
gettext-1.3.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.5.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.4.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.7.0 samples/rails/app/helpers/blog_helper.rb
gettext-1.6.0 samples/rails/app/helpers/blog_helper.rb