0

我通过以下步骤安装了 calendar_date_select

添加到gemfile

# To use calendar_date_select
gem 'calendar_date_select', :git => 'git://github.com/paneq/calendar_date_select.git'

捆绑安装

bundle install

我的 application.html.erb 看起来像

<head>
  <title><%= full_title(yield(:title)) %></title>
  <%= stylesheet_link_tag    "application", media: "all" %>
  <%= javascript_include_tag "prototype" %>
  <%= javascript_include_tag :defaults %> 
  <%= calendar_date_select_includes "silver" %>     
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
  <%= render 'layouts/shim' %>
</head>

然后我用这条线从日历中获取数据。

<%= calendar_date_select_tag "startdate", nil, :embedded => true, :year_range =>  10.years.ago..0.years.ago %>

这就是页面源的样子

<input id="startdate" name="startdate" type="hidden" /><span id="cds_placeholder_89036" style="display: none; position: absolute;"></span><script type="text/javascript">

//

但我根本看不到我的浏览器上的插件。

4

1 回答 1

0

页面上可能没有加载 javascript。您可能需要<%= calendar_date_select_includes %>在布局的头部添加。

编辑 1:对不起,我现在在您的来源中看到它。

编辑2:<%= calendar_date_select_includes "silver" %>应该在之后<%= javascript_include_tag "application" %>

于 2012-07-05T02:00:19.797 回答