free as in air

2007|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|09|11|12|
2012|03|04|05|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|03|04|06|09|
トップ «前の日記(2011-12-29) 最新 次の日記(2012-03-28)» /編集

2011-12-30 [長年日記]

§ [program] Rails3.1の入力フォームの日付欄で和暦を選択したい

 Eiji SakaiのDateHelperJaは2.3系までの対応なので少々変更する。変更点は以下のとおりなんだけど後方互換性はありません。

            diff -ru date_helper_ja/init.rb sites/dairymen/vendor/plugins/date_helper_ja/init.rb
            --- date_helper_ja/init.rb      2011-10-30 05:30:30.166390071 -0700
            +++ sites/dairymen/vendor/plugins/date_helper_ja/init.rb        2011-10-30 02:53:27.299188351 -0700
            @@ -8,11 +8,7 @@
             # http://d.hatena.ne.jp/elm200/
             #
            
            -PLUGIN_NAME = 'date_helper_ja_' + RAILS_GEM_VERSION.gsub(/\./, '_')
            +PLUGIN_NAME = 'date_helper_ja'
             PLUGIN_PATH = File.dirname(__FILE__) + "/lib/" + PLUGIN_NAME + ".rb"
 
            -if FileTest.exist?(PLUGIN_PATH)
            -  require_dependency PLUGIN_NAME if defined? ActionView::Base
            -else
            -  require_dependency 'date_helper_ja' if defined? ActionView::Base
            -end
            +require_dependency PLUGIN_NAME if defined? ActionView::Base
            
            diff -ru date_helper_ja/lib/date_helper_ja.rb sites/dairymen/vendor/plugins/date_helper_ja/lib/date_helper_ja.rb
            --- date_helper_ja/lib/date_helper_ja.rb        2011-10-30 05:30:30.166390071 -0700
            +++ sites/dairymen/vendor/plugins/date_helper_ja/lib/date_helper_ja.rb  2011-10-30 04:18:25.542811350 -0700
            @@ -105,9 +105,10 @@
            
                       select_html = "\n"
                       select_html << content_tag(:option, '', :value => '') + "\n" if @options[:include_blank]
            -          select_html << select_options_as_html.to_s
            +          select_html << prompt_option_tag(type, @options[:prompt]) + "\n" if @options[:prompt]
            +          select_html << select_options_as_html
            
            -          content_tag(:select, select_html, select_options) + time_unit(type).to_s + "\n"
 
            +          (content_tag(:select, select_html.html_safe, select_options) + time_unit(type) + "\n").html_safe
                     end
                     alias_method_chain :build_select, :jp_time_unit