Mini-panels are, for the most part, working great now with this addition (from #1245428-30: panels layouts break column alignment) except in one case. Our friend, IE7 and below have problems with negative margins.

See http://www.brunildo.org/test/relayout.html for a test page of what the exact issues are, and http://haslayout.net/css/Negative-Margin-Bug for an explanation of two possible solutions. The solution I went with is the second solution to set the "hasLayout" on the container with the negative margin, using zoom and position properties.

Patch in first comment.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jwilson3’s picture

Status: Active » Needs review
FileSize
289 bytes

A pretty trivial fix, took a nice chunk of time to track down.

DamienMcKenna’s picture

Status: Needs review » Needs work

Minor thing: it needs spaces between the colon and the value to match the rest of the file's formatting.

Cellar Door’s picture

Assigned: Unassigned » himerus
Status: Needs work » Patch (to be ported)

To be included in 3.2. Thanks!

anniegreens’s picture

Patch re-rolled for latest dev. Also, removed redundant addition of 'position: relative.'

jwilson3’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Looks good. #facepalm on the duplicate position:relative :/

apmsooner’s picture

Theres a better way to fix this in my opinion. Remove the negative margin style all together and use the alpha/omega classes on the panel-panes.
Example:
<div class="panel-panel grid-12">

change to:
<div class="panel-panel grid-12 alpha omega">

and a 3 column layout would be changed to this:

<div class="panel-panel grid-4 alpha"></div>
<div class="panel-panel grid-4"></div>
<div class="panel-panel grid-4 omega"></div>

I came across this same issue as i'm getting ready to deploy a new module containing lots of extra panel layouts and that was my approach that fixes the issue.

apmsooner’s picture

Here's my implementation as a separate module: http://drupal.org/sandbox/apmsooner/1805170

jwilson3’s picture

@apmsooner, the idea for adding alpha and omega classes is not new. It was also discussed in #1245428: panels layouts break column alignment where we collectively decided that in order to support all the cases, negative margin is the current best solution.

To sum it up, the negative margin solution was used so that you could place a panel directly into a region (ie, the content region) OR place a panel into a block into a region (eg mini panels). It was the only solution that worked correctly in both cases.

I'd be curious to see if your solution passes the issues brought up on that thread about rendering blocks as mini-panels placed in an omega region.

apmsooner’s picture

@jwilson3, my alternate approach was due to the fact that i felt a decision had already been made to commit a patch to omega and i didn't want to interfere with confusing the matter more or step on someone's toes. On top of that, i created a large number of layouts that I wanted to contribute back to the community but implemented in a way that I felt was best according to my testing.
My solution for mini-panels is a fairly simple one.... don't use the 12 grid columns at all but rather create region defined width layouts that mini-panels will fit right into. For example, if your content region is 8 columns, a mini-panel with 2 .grid-4 columns will line up perfectly in that region. (I have notes on my module page regarding that).
An Omega layout with 3 columns of .grid-4... well that equals 12 so i'm not sure how that would ever fit into a .grid-8 region with blocks enabled unless you only filled 2 of the columns and don't use .alpha and .omega classes as I have. I'm going about this with the idea if you chose a particular layout, you intend to fill the spaces which is why i've provided a ton of variation to avoid unnecessary divs if not needed. Feel free to check out my sandbox and let me know if you find something broken there but I feel pretty confident i've provided a viable alternative at the very least. I'm open to feedback/criticism :)

As far as patching omega, it would involve all the layouts. As i mentioned, any full width pane should have both .alpha and .omega classes assigned. An inner pane should have .alpha and outer pane should have .omega. Again, i feel there are different opinions on that though.

jwilson3’s picture

Kind of a side note, but if someone is using Omega with Panels in a way that you have randomly sized regions from Omega's layout designer *and* trying to put mini-panels inside them, they're probably doing it wrong.

I totally understand the flexibility of omega's own grid/zone layout designer, but I couldn't understand why someone would want to mix and match half their region layouts with panels, and the rest with omega, and then on top of that still use mini-panels. My omega sites end up being very straight-forward: 3 zones (header, content, footer) with three full-width regions (also called header, content, footer). Your argument, if i understand it, then is that I cannot use your library of many amazing layouts for the header and footer mini-panel layouts, but that I would need to create my own panels that don't have the alpha / omega classes.

apmsooner’s picture

Well if you have a 12 grid region, whether it be a panel region or theme region, a 12 column mini-panel will line up just fine. If someone however is trying to put a 12 column mini-panel into a 8 column content region as a block.... there would be problems.
There are alot of scenarios where you would want to have the flexibility of panels with blocks disabled vs. panels with blocks enabled along with mini-panel support for either scenario. As much variety I've provided with the layouts from my module, there could still be use cases where someone might want to drop a 2 column .grid-4 mini-panel into an 8 column panel region from a layout that works well otherwise. Also, if we define mini-panels with fixed regions as I've mentioned, they will fit right into any region with a grid class equal to the width of the mini-panel. The mini-panel layouts should have alpha omega classes in its wrapper and let the parent panel pane or block region handle the margin. That ensures everything fits.
With your scenario, i'm not sure what grid-width you are using for your regions but if you have a 12 column region, any of my 12 column layouts will fit right in there. All of my panels layouts have the alpha/omega classes and i've used a different parent div class called 'responsive-grid' instead of 'omega-grid' to eliminate the negative margin. If you prefer negative margin:

.responsive-grid {
margin-left:-10px;
margin-right:-10px;
}
.responsive-grid .alpha,
.responsive-grid .omega {
margin-left:0;
margin-right:0;
}

Problem solved if you add that to your stylesheet. Other than that, there are absolutely no difference between my layouts vs. omega layouts aside from the added variety and some additional row classes to help with theming. 12 column layouts fit 12 columns however you use them.
The only issues i've found are global whether it be omega panels or from my module responsive panels which is that any panel grids contained under .omega-grid or .responsive-grid in my module should have their margin left and right properties set to 0 in the mobile stylesheet since the container theme region already has margin set. Otherwise, you have additional margin added on mobile devices for no reason.... but thats a separate issue i'll raise in the omega support queue.

apmsooner’s picture

Lets expand on this margin issue a little more and see if we can collaboratively make sense of it. Lets assume you have an 8 grid content region and one 4 column sidebar region set in the theme. By default, omega's grid classes will set your widths as defined below:

.container-12 .grid-8 {
    width: 620px;
}
.container-12 .grid-4 {
    width: 300px;
}

Omega already sets the margin for those theme regions of 10px on each side to give you the total of 960px. Whatever you put in either region should NOT add additional margin or it will break the layout. So, if you put a 2 column mini-panel with .grid-4 classes assigned to each column in that content region, you have to account for the margin that is already set for the container .grid-8. Because .grid-4 equals 300px and by default .grid-4 in the theme style sheet has margin set to 10px on both sides, you have to remove 20px of it to fit in the container. I do this by adding .alpha to the first column and .omega to the second column. That leaves 20px of margin between the 2 columns to give it separation and makes total width = 620px. If done this way, I just don't see any need for negative margin being used in any scenario thus you get rid of those issues in IE7. Plus, the .alpha and .omega classes aren't even applied when rendered from a mobile device so all is good right?
Again, i don't see 12 column panel layouts working as a mini-panel unless the container region you are putting the mini-panel = 12 columns which is why I've gone the route of adding a few samples set to 8 and 9 columns to provide the flexibility to keep block regions enabled or expand layout in a parent panel pane. Ideally, i'd like to expand mini-panel layouts much greater in my module to account for even greater variation.

jwilson3’s picture


.responsive-grid .alpha,
.responsive-grid .omega {
margin-left:0;
margin-right:0;
}

You're removing the right and left margins on both the alpha and omega classes. (without actually testing this) i cant possibly see how that would still stay aligned to the grid. I thought alpha is supposed to remove the left margin, omega removes the right.

jwilson3’s picture

... I think the best thing for me to do is to try out your module ;) might save some typing.

apmsooner’s picture

#13 example is only necessary if you wanted to keep the negative margin approach. Thats not my approach. The only css i've added was for the admin side to make the layout look right in the admin section of panels. I really tried to keep extra styling and such up to the themer that uses the panels and not have to override anything i put in. Let me know what you think of the module if and when you get a chance to check it out. More layouts are on the way...

apmsooner’s picture

Issue summary: View changes

Clean up problem statement.