I had a problem with multiple sort containers being added around sortable markup - each box had 3 <div class="panels-ipe-sort-container" /> tags around them. The effect of this was to have ghost sort containers appearing when dragging my sortable content, and 'drop' action not succeeding. No idea (yet!) what causes the three calls to createSortContainers, but I've created a patch to add in a check when adding a sort container that makes sure the parent's class is not .panels-ipe-sort-container.
Anyone else have a similar issue?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | ipe-duplicate-1354572-7.patch | 2.69 KB | yched |
| #3 | multiple_sort_containers_markup.png | 85.56 KB | joe-b |
| #3 | multiple_sort_containers.png | 42.79 KB | joe-b |
| ipe_no_multiple_containers.patch | 1.54 KB | joe-b |
Comments
Comment #1
Letharion commentedSorry, but I don't quite understand in which situation this happens. Maybe a screenshot could help?
Comment #2
merlinofchaos commentedHm yeah, I've never had this happen myself. Maybe something weird with behaviors?
Comment #3
joe-b commentedNo, neither do I yet, just that it's happening in our setting (intranet, so I can't point you to it, sorry). Frustrating, I know. I was putting this out there to find out if anyone else has similar problems, really.
Here's a couple of screenshots, then - 1st of the markup being generated, and 2nd of the effect, with ghost sort containers floating with the drag-and-drop motion.
Comment #4
Letharion commentedCan you reproduce it on a clean install?
Comment #5
Letharion commentedComment #6
yched commentedSorry to reopen an old issue, but this is the closest I found to the issue I'm seeing.
The problem is that panels_ipe.js's createSortContainers() seems to only work if the markup spitted by the region style directly consists of the draggable panes, with no surrounding markup.
If the region style adds wrapping markup, then:
- if the region is not empty, createSortContainer() produces *two* '.panels-ipe-sort-container ' divs.
- then bad things happen when you add a new block through IPE: the markup for the new block gets inserted twice (one for each 'panels-ipe-sort-container'),
- then on "Save" you get an "Integrity constraint violation: Duplicate entry for key PRIMARY: INSERT INTO {panels_pane}" error.
Easily reproduced with "list" region style, or any custom style created with Stylizer :
- Take a region that's not empty (or add a custom block in it, save)
- Switch the region style to "List / unordered", and save.
- Using the IPE, add a new custom block to the region --> The markup appears twice, once in the ul/li, once above
- Save --> "Integrity constraint violation" error.
Comment #7
yched commentedAttached patch seems to do the trick :
- Makes sure that createSortContainers() targets the right 'panels-ipe-portlet-marker' (there is one per region + one per pane in the region, we want the one of the region), and thus does not create duplicate 'panels-ipe-sort-container' divs for each region
- After a new pane is created, makes best effort to insert the HTML at the "right" place within the wrapping markup for the region - that is, before the 1st existing pane in the region. If the region was empty so far, there's no way to find that "right" sport, insert it as a child of the 'panels-ipe-sort-container' div like current code does.
Won't always be perfect, for example, in the case of the "list / unordered" region style, the new pane will appear just before the former first pane but within the same
<li>. But works fine for Stylizer or other 'simple div' based Styles.Note: patch is against -dev, but was developped and tested against 7.x-3.3 only. Dunno if things have changed a lot in this area since then...
Comment #8
yched commentedClearer explanation:
Current code works with "default" region style, because while there are several $('div.panels-ipe-portlet-marker', this), they are all siblings and thus have the same parent --> wrapInner() operates on a jQuery set with a single element, 'panels-ipe-sort-container' is added once.
That's not true anymore for region styles with wrapping markup: there are several $('div.panels-ipe-portlet-marker', this) with different parents --> several 'panels-ipe-sort-container' end up being created for the region.
Comment #9
hefox commentedFixed the issue for me
Comment #10
populist commentedI tested this patch a bit with Panopoly and things generally seem to work right. Anyone else have any feedback?
Comment #11
mpotter commentedThis patch is also being used and is working in Open Atrium 2.
Comment #12
asgorobets commentedPatch from #7 also resolved the issue for me. Thanks yched!
Comment #13
japerryTested and Fixed!
Commit here:
http://drupalcode.org/project/panels.git/commit/63cf629