【发布时间】:2015-05-25 03:30:27
【问题描述】:
我累了。我有用户模型的基本完整日历。我想添加 2 个按钮,用户可以在其中将日历分成两个。首先他只得到他的事件,然后在几秒钟内他得到所有用户的所有事件。我该怎么做?我是 Rails 的新手 :) 这是我的js代码
$(document).ready ->
$("#calendar").fullCalendar(
events: '/events.json'
eventColor: '#378006'
eventBackgroundColor: 'red'
)
还有我的 json 事件文件
json.array!(@events) do |event|
json.extract! event, :id, :title, :description, :user_id
json.start event.start_time
json.end event.end_time
json.url event_url(event, format: :html)
if (event.user_id == current_user.id)
json.color 'green'
end
end
【问题讨论】:
标签: javascript jquery ruby-on-rails fullcalendar