- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的应用程序的同一方面有两个问题,抽象 View 是这样的:
该应用程序允许用户查看不同的视频剪辑。在后端/管理部分,管理员可以跟踪任何特定剪辑组的 View 。例如,管理员可以选择 Universal Studios
,选择一个 日期范围:开始日期:2015-01-1,结束日期: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 -%>
最佳答案
你为什么不做这样的事情:
<%=label_tag :start_date, "Start Date" %>
<input id="datepicker" name="someName" ...any other options>
然后:
<script>
$(document).ready(function(){
$("#datepicker").datepicker();
});
</script>
然后当然也为 end_date
添加一个类似的字段。
请注意,您必须在 application.js
中包含 //= require jquery-ui/datepicker
关于ruby-on-rails - 日期范围不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35493222/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!