如何为一周的日历自定义表格构建器插件?
我正在使用表格构建器
https://github.com/p8/table_builder
对于我在此Rails演员中找到的日历:
http://railscasts.com/episodes/213-calendars 。
我的问题是,默认情况下,日历按月显示,但我想按周显示。 有谁知道如何自定义日历的显示? 这是我的日历视图:
<%= link_to " (@date.beginning_of_month-1).strftime("%Y-%m-%d") %> ", :month => (@date.end_of_month+1).strftime("%Y-%m-%d") %>
@date.year, :month => @date.month do |calendar| %> :date) do |date, statuses| %>
这是控制器:
class CalendarController current_user.id) @statuses = do_withs.collect { |f| f.status_id } @statuses = @statuses.collect { |f| Status.find(f) } @statuses = @statuses + current_user.statuses @statuses.flatten! @date = params[:month] ? Date.parse(params[:month]) : Date.today end end
设置first_day_of_week: 1
,如下所示:
<%= calendar_for @statuses, year: @date.year, month: @date.month, first_day_of_week: 1 do |calendar| %>
并相应调整calendar.head
:
<%= calendar.head('Monday', 'Tuesday'...