Skip to content

Commit

Permalink
Merge pull request #4 from yvesdm/patch-1
Browse files Browse the repository at this point in the history
Fix for JENKINS-19376 : Display problem fixed when using 1/3 left/center...
  • Loading branch information
tbingaman committed Nov 18, 2015
2 parents 38c0e1e + 277b2c7 commit 587de4b
Showing 1 changed file with 11 additions and 5 deletions.
Expand Up @@ -146,13 +146,19 @@ protected Object readResolve() {

private void determineCss() {
final StringBuffer css = new StringBuffer();
css.append(width.getCss());

css.append(alignment.getCss());
if (width == Width.FULL || alignment == Positioning.CENTER) {
if (width == Width.THIRD && alignment == Positioning.CENTER) {
css.append("width: 34%; "); // the center part takes 34% so 33% + 34% + 33% = 100%
}
else {
css.append(width.getCss());
}
if (width == Width.FULL) {
css.append("clear: both; ");
} else if (alignment == Positioning.LEFT) {
css.append("clear: left; ");
} else if (alignment == Positioning.RIGHT) {
} else if (alignment == Positioning.RIGHT || alignment == Positioning.CENTER) {
css.append("clear: right; ");
}
this.css = css.toString();
Expand Down Expand Up @@ -206,7 +212,7 @@ public String getCss() {
* Constants that control how a Section is positioned.
*/
public enum Positioning {
CENTER("Center", "margin-left: auto; margin-right: auto; "),
CENTER("Center", "margin-left: auto; margin-right: auto; float: left;"),
LEFT("Left", "float: left; "),
RIGHT("Right", "float: right; ");

Expand Down Expand Up @@ -277,4 +283,4 @@ public String getName() {
Stapler.CONVERT_UTILS.register(new EnumConverter(), Width.class);
}
}
}
}

0 comments on commit 587de4b

Please sign in to comment.