我对 Rails 比较陌生。我正在使用 Rails 3,带有 UI Datepicker 的简单表单,它是 jquery 日期时间选择器的包装器。在https://github.com/kristianmandrup/ui_datepicker-rails3的自述文件中,有几行
Activate it like this:
UiDatePickerRails3.activate :simple_form
This can be done fx from inside an initializer. You can pass either :simple_form, :formtastic or :active_admin to the #activate method.
我不知道在哪里放置或运行 UiDatePickerRails3.activate :simple_form 来激活它。
我的查看代码
%h2
Create new task
= simple_form_for @task do |f|
= f.input :name, :wrapper_html => { :id => 'name' }
= f.input :description, :wrapper_html => { :id => 'description' }
= f.input :price, :wrapper_html => { :id => 'price' }
= f.association :task_type
= f.input :content, :as => :ckeditor, :label => "Nội dung task", :input_html => {:toolbar => 'Full' }
= f.input :expired_at, :wrapper_html => {:id => 'expired_at', :class => 'ui-date-picker'}
-#= f.input :expired_at, :as => :date_picker
= f.button :submit
这是我的 application.js 文件
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require bootstrap
//= require_tree .
//= require ckeditor/init