前段时间一直忙于公司的项目,开发过程中苦于无一款国人用的顺手的日历组件,如 my97. 这两天研究了下 gem,并把 my97 calender 做成 gem 包,方便使用,好了,费话少说,放出源码: https://github.com/peterfei/my97-rails
Step 1
group :assets do
gem 'my97-rails'
end
Step 2
Run 'bundle install'
Step 3
Require WdatePicker.js
in your Javascript manifest (e.g. application.js
)
//= require WdatePicker
Step 4 Require WdatePicker.css in your CSS manifest (e.g. application.css)
*= require WdatePicker
<%=f.my97_date_select :date,:class=>"Wdate" %>
<%=f.my97_datetime_select :date,:class=>"Wdate" %>
##Enjoy!!!
带日期时间:
日历就用日历的名字嘛,干嘛起个 engine ... 看了一下,这个 Gem 里面就包了 JS 文件,没有其他的功能实现,这种就不要搞成 Gem 了,有点浪费 RubyGems 的资源...
版本已更新:
<%=f.my97_date_select :date,:class=>"Wdate" %>
<%=f.my97_datetime_select :date,:class=>"Wdate" %>
样式可自订义。
#19 楼 @peterfei gedit 生成的临时文件也被 push 上去了 https://github.com/peterfei/my97-rails/blob/master/lib/my97-rails/my97_form_builder.rb~
报错。couldn't find file 'WdatePicker'
(in /home/xxx/project/app/assets/stylesheets/application.css.scss:13)