Can you please provide the title and date of the event, but I also need additional fields to be displayed?
By modifying the index.json.jbuilder like this: (json.title event.user.email), instead of showing the title it displays the email. However, I require to show :user, :title, :sala, :materia.
_event.json.jbuider
date_format = event.all_day_event? ? '%Y-%m-%d' : '%Y-%m-%dT%H:%M:%S'
json.extract! event, :id, :title, :sala, :materia, :user_id
json.start event.start.strftime(date_format)
json.end event.end.strftime(date_format)
json.color event.color unless event.color.blank?
json.allDay event.all_day_event? ? true : false
json.update_url event_path(event, method: :patch)
json.edit_url edit_event_path(event)
_index.json.jbuider
json.array! @events do |event|
json.extract! event, :id, :title, :sala, :materia, :user_id
date_format = event.all_day_event? ? '%Y-%m-%d' : '%Y-%m-%dT%H:%M:%S'
json.start event.start.strftime(date_format)
json.end event.end.strftime(date_format)
json.color event.color unless event.color.blank?
json.allDay event.all_day_event? ? true : false
json.update_url event_path(event, method: :patch)
json.edit_url edit_event_path(event)
end
fullcalendar_js
var initialize_calendar;
initialize_calendar = function() {
$('.calendar').each(function(){
var calendar = $(this);
calendar.fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaDay',
selectable: true,
selectHelper: true,
slotDuration: '00:60:00',
slotEventOverlap: false,
forceEventDuration: true,
minTime: '08:00:00',
maxTime: '20:00:00',
hiddenDays: [ 6, 7 ],
editable: true,
eventLimit: true,
events: '/events.json',
};
$(document).on('turbolinks:load', initialize_calendar);