calendardateselectを試す。

calendardateselectを試している。

http://code.google.com/p/calendardateselect/

便利そうなんで入れてみると「prototype.jsのバージョンが古いよ!」って怒られた。1.6な最新版にする。

 
ヘッダに召喚呪文を書かないといけないらしいので、ビューの中に入れる。layout.rhtmlに書くと全部で召喚されるので、_form.rhmlに書き込むことにする。

<% content_for :html_header do -%>
<%= calendar_date_select_includes %>
<script type="text/javascript">
  _translations = {
    "OK": "OK",
    "Now": "現在",
    "Today": "今日" 
  }
  Date.weekdays = $w("日 月 火 水 木 金 土");
  Date.months = $w("1 2 3 4 5 6 7 8 9 10 11 12" );
</script>
<% end -%>

ローカライズは別のところでやりたかったけど、良く分からないので決め打ちにする。
 
表示形式を変更したいので、config/enviroment.rbの一番下に加える
 

CalendarDateSelect.format = :hyphen_ampm

これって、\vendor\plugins\calendar_date_select\lib\calendate_date_select.rbの

#  @@format = FORMATS[:natural]
  @@format = FORMATS[:hyphen_ampm]

こんな形にしても同じ。プラグインの中で弄るのは宜しくないので、enviroment.rbで済ます。

 
 
でもって、prototype.jsを更新すると「text_field_with_auto_complete」でエラーになりまくる・・・

auto_completeがエラーをずーーっとだす。

prototype.js(1.6)にしたときの最大の悩みがauto_completeが「too much recursion」とエラーを毎秒ごとにはきまくる。Firebugはエライことになってしまう。
 

http://www.prototypejs.org/2007/5/1/prototype-1-5-1-released


I get a “too much recursion” error on line 1288 when trying to use the 1.51 libs to implement an auto_complete text box in rails/firefox. I spent two days trying to troubleshoot it before using 1.5, which fixed my problem. My JS skills aren’t good enough to fix the error directly, but if any other people out there have the same problem I hope I might save them the pain.

Now that it’s working, it looks great. Props for your hard work.

-g

Gary: updating script.aculo.us to version 1.7.1 beta 2 will solve your recursion issue.

これ、2007年5月のやりとり。
 
イロイロためしてみたけど・・・無理だったorz
カレンダー