Skip to content

Commit

Permalink
Fix for JENKINS-19376 : Display problem fixed when using 1/3 left/cen…
Browse files Browse the repository at this point in the history
…ter/right

Fix css as specified in JENKINS-19376
Also fix percentage when 1/3 center, put 34% to have a sum of 100% (Right + center + left)
  • Loading branch information
yvesdm committed Dec 13, 2013
1 parent 2cd3c8c commit 277b2c7
Showing 1 changed file with 11 additions and 5 deletions.
Expand Up @@ -140,13 +140,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 @@ -200,7 +206,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 @@ -271,4 +277,4 @@ public String getName() {
Stapler.CONVERT_UTILS.register(new EnumConverter(), Width.class);
}
}
}
}

0 comments on commit 277b2c7

Please sign in to comment.