【发布时间】:2016-02-18 21:55:50
【问题描述】:
我的应用程序的同一方面有两个问题,抽象视图是这样的:
该应用程序允许用户查看不同的视频剪辑。在后端/管理部分,管理员可以跟踪任何特定剪辑组的视图。例如,管理员可以选择Universal Studios,选择date range: Beginning Date: 2015-01-1, End Date: 2016-01-1 并点击filter,然后查看Universal 在此范围内收到的总观看次数。
问题是,一方面,datepicker 不再工作,所以当我点击日期字段时,没有出现日历,我必须手动输入日期。对于两个,我只在进一步之间得到结果:2015-10-18 和2016-02-18。当我输入2015-09-18 或任何更早的内容时,它不会产生结果。
查看下面的代码,如果您需要任何其他代码,请告诉我!
Index.html.erb 片段:
<tr>
<td><%= f.text_field :start_date, value: 1.month.ago.strftime('%Y-%m-%d') %></td>
<td><%= f.text_field :end_date, value: Time.now.strftime('%Y-%m-%d') %></td>
<td>
<%= f.submit "Filter", class: "btn btn-danger", data: {disable_with: 'Searching...'} %>
<%= link_to 'Clear Form', '#', id: "clear", class: 'btn btn-default' %>
</td>
</tr>
_impressions.html.erb 片段:
</style>
<div class="clearfix"></div>
<% if @impressions.blank? -%>
<div class="span12"><h1>Nothing found</h1></div>
<% else %>
<div class="alert alert-success">
<div class="">Total Views: <b><%= @impressions.count %></b></div>
<div class="">Percentage to overall views: <b><%= @percentage.round(2) %>%</b></div>
</div>
<table id="table_3" class="table table_output">
<thead>
<tr>
<td class="stat_head">Studio</td>
<td class="stat_head">Film</td>
<td class="stat_head">Clip</td>
<td class="stat_head">User</td>
<td class="stat_head">State</td>
<td class="stat_head">Country</td>
<td class="stat_head">Type</td>
<td class="stat_head">Date</td>
</tr>
</thead>
<tbody>
<% @impressions.each do |impression| -%>
<% @clip = Clip.where(id: impression.impressionable_id).first %>
<% user = User.where(id: impression.user_id).first %>
<tr>
<td><%= link_to @clip.film.studio.name, saas_admin_studio_path(@clip.film.studio) %></td>
<td><%= link_to @clip.film.name, saas_admin_studio_film_path(@clip.film.studio, @clip.film) %></td>
<td><%= link_to @clip.name, saas_admin_studio_film_clips_path(@clip.film.studio ,@clip.film) %></td>
<td><%= user.present? ? (link_to user.username, saas_admin_account_user_path(user.account, user)) : ' - ' %></td>
<td><%= user.present? ? user.account.organization.state : ' - ' %></td>
<td><%= user.present? ? user.account.organization.country_id : ' - ' %></td>
<td><%= user.present? ? user.account.subscription.state : ' - ' %></td>
<td><%= user.present? ? impression.created_at.strftime("%b %e, %Y %l:%M%P") : ' - ' %></td>
</tr>
<% end -%>
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-4 datepicker