Posted by mgriffith on April 1, 2011 at 10:01pm
7 followers
| Project: | Calendar |
| Version: | 6.x-2.x-dev |
| Component: | jCalendar popup |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
| Issue tags: | Commit |
Issue Summary
Displaying a month-view calendar, I click on an event and the popup from jcalendar displays but is empty.
The issue appears to be here:
// Get NodeID and ItemID
var ids = $(this).parent().parent().attr('class');In my out-of-the-box calendar view, the node and item ids are in the id attribute and not the class.
<div class="calendar monthview" id="calendar.2688.field_event_date.13.13">Solution: Modified jcalendar.js to use the id attribute instead of the class.
Patch attached (mostly because I wanted to learn how to make a patch...)
| Attachment | Size |
|---|---|
| jcalendar.patch | 434 bytes |
Comments
#1
I don't understand why one site on a multisite install, using the same copy of the module, would have the string with the nid and ids in the class and another site has it in the id. Further modified the jcalendar.js (starting at line 48) to check for either a class or id.
// Get NodeID and ItemIDvar classStr = $(this).parent().parent().attr('class');
var ids = (classStr.indexOf('.') != -1) ? classStr : $(this).parent().parent().attr('id');
var arrs = ids.split(" ");
var arr = arrs[0].split(".");
var nid = arr[1];
var id = arr[4];
#2
Confirmed: I also have this problem, and the supplied patch (either version, on my site) fixes it. Thanks very much mgriffith, for supplying the fix.
#3
I can also confirm, manually changing line 48 in current dev version:
old:
var ids = $(this).parent().parent().attr('class');new:
var ids = $(this).parent().parent().attr('id');This works perfectly.
#4
I would like to confirm that this works, as well... Can this get a commit?
#5
The JS in the patch (and the module, initially) is brittle and depends on a certain markup structure. I'm attaching a patch that searches the DOM tree a bit more thoroughly, so that extra divs will not break it.
#6
Could someone review #5?
#7
I applied the patch in #5 against Calendar 6.x-2.4, which applied cleanly and resolved the problem.
Thanks for the patch!
#8
didn't apply clean to 2.x dev version for me
attached is re-rolled version that's drush make friendly :)