Export to GitHub

fullcalendar - issue #327

Default cursor for non-editable no-url events


Posted on Feb 6, 2010 by Quick Rabbit

Background: I have a RESTful resource that outputs events for fullcalendar to consume in JSON format. These events are returned with a className of "custom" and editable:true.

I have two places in my app that use the fullcalendar plugin. One is display-only and the other one is editable. I use disableDragging/disableResizing on the display-only calendar.

Here is the CSS:

.custom, .fc-agenda .custom .fc-event-time, .custom a { cursor: default; }

On the display-only calendar, this displays events that cannot be edited and the cursor doesn't indicate that it can be edited. This is what I want.

On the editable calendar, the events can be edited, but the cursor doesn't change to indicate this capability. I want the cursor to use fullcalendar's CSS settings for cursor (pointer, s-resize, etc.)

I could return a different classnames to each calendar, such as "custom" and "editable". But the server would then need to know when to output which className.
I would need to send a parameter or use a different URL, and I don't want to complicate the server API just for this simple purpose.

Could fullcalendar be updated to change the cursor of an event based on if it is editable or not? I've got this working with the following update to the code (this code should be repeated in 3 different locations):

if (event.editable || event.editable == undefined && options.editable) { draggableDayEvent(event, eventElement, seg.isStart); if (seg.isEnd) { view.resizableDayEvent(event, eventElement, colWidth); } // Added TNM 2010/02/05 if (options.disableDragging && options.disableResizing) { eventElement.children('a').css('cursor','default'); } } // Added TNM 2010/02/05 else { eventElement.children('a').css('cursor','default'); }

I realize this doesn't take into account Events with clickable URLs. Right now I don't want clickable URLs anyway and am disabling all URLs by overriding eventClick to return false. But for fullcalendar to know if you want a URL to be clickable or not, just overriding eventClick won't let it know. Yet another setting might be necessary. Something like "clickable: false". Then people wouldn't have to override eventClick either.

Comment #1

Posted on Feb 6, 2010 by Helpful Monkey

the best solution might be to use eventRender (http://arshaw.com/fullcalendar/docs/event_rendering/eventRender/):

$('#calendar').fullCalendar({ eventRender: function(event, element) { if (event.editable) { element.css('cursor', 'whatever'); } } });

does this help at all?

Comment #2

Posted on Feb 6, 2010 by Quick Rabbit

Ah, yes that should work! I'll give it a shot. Thanks!

Still, it seems like this might be good to add to the core. It doesn't make sense to show a pointer cursor if the item isn't editable or have a URL.

Comment #3

Posted on Feb 6, 2010 by Helpful Monkey

yeah, you are probably right. if i attached an "fc-event-editable" class to editable events, and used the "a:link" pseudo class, you could have control over this stuff via the stylesheet

Comment #4

Posted on Mar 21, 2011 by Helpful Monkey

fixed in 1.5 (just released)

Comment #5

Posted on Aug 14, 2013 by Helpful Monkey

(No comment was entered for this change.)

Comment #6

Posted on Aug 14, 2013 by Helpful Monkey

(No comment was entered for this change.)

Status: Released

Labels:
Type-Defect