日付ピッカー ( bootstrap-datepicker-rails gemを使用) を取得して、 bootstrap modalを使用してsimple_formを介して表示しようとしていますが、運がありません。
私は次のようなものをたくさん読みました:
https://github.com/Nerian/bootstrap-datepicker-rails/issues/51 bootstrap-datepicker-rails をセットアップするには? http://learningnewtricks.wordpress.com/2013/07/03/bootstrap-date-picker-on-rails-so-simple/ http://www.chadcf.com/blog/jqueryui-datepicker-rails-and- simpleform-簡単な方法
私が得るのはテキストフィールドだけですが、それをクリックしても日付ピッカーはありません。日付ピッカーがモーダルの背後にある可能性があります。そうであれば、それを修正する方法はありますか?
私のセットアップは次のとおりです。
fyousuf$ rails -v
Rails 3.2.12
fyousuf$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
アプリ/アセット/スタイルシート/application.css
*= require_self
*= require fullcalendar
*= require bootstrap-datepicker
*= require_tree .
アプリ/資産/javascripts/application.js
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require bootstrap
//= require fullcalendar
//= require bootstrap-datepicker
//= require_tree .
アプリ/資産/javascript/s/events.js
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$('[data-behaviour~=datepicker]').datepicker({"format": "yyyy-mm-dd", "weekStart": 1, "autoclose": true});
アプリ/ビュー/イベント/_form.html.erb
<%= simple_form_for(@event) do |f| %>
...
<%= f.input :starts_at, :as => :string, :input_html => { data: {behaviour: "datepicker"}} %>
...
<% end %>