ror中可以很方便的使用与jsCalendar一样的控件:
该网页的地址[url]http://dry.4thebusiness.com/info/dhtml_calendar[/url]
1、在工程文件的根目录下运行下面的更新[code]ruby script/plugin install http://dhtml-calendar.googlecode.com/svn/trunk[/code]
2、在.rhtml文件中置入:[code]<%= dhtml_calendar_includes %>[/code]
这样就可以使用Calendar控件了。一共有5个模式供用户选择:
1、弹出式:页面只有一个日历牌的图标,用户点击后,弹出控件:[code]<%= popup_calendar 'person', 'birthday',
{ :class => 'date',
:field_title => 'Birthday',
:button_image => 'calendar.gif',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]
2、普通方式:日历完整显示在网页中:[code]<%= calendar 'person', 'birthday',
{ :class => 'date' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true }
%>
[/code]
3、输入框式:页面中显示一个输入框,鼠标点击后弹出日历供用户选择[code]<%= calendar_field 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>
[/code]
4、选择框式:页面显示一个标准的选择框和一个日历的图表,点击后弹出日历[code]<%= calendar_select 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]
5、box:页面显示一个输入框和一个日历图表,点击图标后显示一个日历[code]<%= calendar_box 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:form_name => 'custform',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]
该网页的地址[url]http://dry.4thebusiness.com/info/dhtml_calendar[/url]
1、在工程文件的根目录下运行下面的更新[code]ruby script/plugin install http://dhtml-calendar.googlecode.com/svn/trunk[/code]
2、在.rhtml文件中置入:[code]<%= dhtml_calendar_includes %>[/code]
这样就可以使用Calendar控件了。一共有5个模式供用户选择:
1、弹出式:页面只有一个日历牌的图标,用户点击后,弹出控件:[code]<%= popup_calendar 'person', 'birthday',
{ :class => 'date',
:field_title => 'Birthday',
:button_image => 'calendar.gif',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]
2、普通方式:日历完整显示在网页中:[code]<%= calendar 'person', 'birthday',
{ :class => 'date' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true }
%>
[/code]
3、输入框式:页面中显示一个输入框,鼠标点击后弹出日历供用户选择[code]<%= calendar_field 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>
[/code]
4、选择框式:页面显示一个标准的选择框和一个日历的图表,点击后弹出日历[code]<%= calendar_select 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]
5、box:页面显示一个输入框和一个日历图表,点击图标后显示一个日历[code]<%= calendar_box 'person', 'birthday',
{ :class => 'date',
:date => value,
:field_title => 'Birthday',
:form_name => 'custform',
:button_title => 'Show calendar' },
{ :firstDay => 1,
:range => [1920, 1990],
:step => 1,
:showOthers => true,
:cache => true }
%>[/code]