【发布时间】:2011-09-19 04:53:35
【问题描述】:
我正在使用带有 rails 2.3.8 的 event_calendarplugin。我有带有名称、地点和培训师列的活动表。我想根据培训师和场地为活动着色。我可以让教练给它上色。但是现在我想将参数传递给事件日历助手,考虑它是培训师还是场地。我应该如何传递这个参数?有人使用这个插件吗?请帮帮我....
【问题讨论】:
标签: ruby-on-rails ruby
我正在使用带有 rails 2.3.8 的 event_calendarplugin。我有带有名称、地点和培训师列的活动表。我想根据培训师和场地为活动着色。我可以让教练给它上色。但是现在我想将参数传递给事件日历助手,考虑它是培训师还是场地。我应该如何传递这个参数?有人使用这个插件吗?请帮帮我....
【问题讨论】:
标签: ruby-on-rails ruby
如果你看一下 README.rdoc,你会得到 p>
<%= event_calendar %>
==Default Options
The default options for the calendar are:
defaults = {
:year => Time.zone.now.year,
:month => Time.zone.now.month,
:abbrev => true,
:first_day_of_week => 0, # See note below when setting this
:show_today => true,
:month_name_text => Time.zone.now.strftime("%B %Y"),
:previous_month_text => nil,
:next_month_text => nil,
:event_strips => [],
# it would be nice to have these in the CSS file
# but they are needed to perform height calculations
:width => nil,
:height => 500,
:day_names_height => 18,
:day_nums_height => 18,
:event_height => 18,
:event_margin => 1,
:event_padding_top => 1,
:use_all_day => false,
:use_javascript => true,
:link_to_day_action => false
}
我在日历中采用以下两个参数,并在
中覆盖插件辅助方法<%= event_calendar(user.format, outbound) %>
app/helpers/calendar_helper.rb
def event_calendar_opts(display_format, outbound)
{
:year => @year,
:month => @month,
:abbrev => nil,
:event_strips => @event_strips,
:display_properties => (display_format==4)? 4 : 3,
:outbound => outbound,
:month_name_text => I18n.localize(@shown_month, :format => "%B %Y"),
:previous_month_text => month_link(@shown_month.last_month),
:next_month_text => next_month_link(@shown_month.next_month) }
end
def event_calendar(display_format, outbound)
# args is an argument hash containing :event, :day, and :options
index = 0
calendar event_calendar_opts(display_format, outbound) do |args|
html << some_html
html
end
end
【讨论】:
options[:display_properties]。重要的是,无论何时您更改插件,都请重新启动我们的服务器。