Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-23772] Fix jelly views
  • Loading branch information
kinow committed Sep 14, 2015
1 parent a7eb7fd commit 8128c33
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 47 deletions.
Expand Up @@ -169,4 +169,17 @@ public Integer getImageInnerWidth() {
public String getImageInnerWidthText() {
return imageInnerWidthText;
}

public Object readResolve() {
String width =
(imageWidth != null && imageWidth > 0) ? Integer.toString(imageWidth) : "0";
String innerWidth =
(imageInnerWidth != null && imageInnerWidth > 0) ? Integer.toString(imageInnerWidth) : "0";
return new ComparativeImagesGalleryBuildAction(
title,
tree,
width /*imageWidthText*/,
innerWidth /*imageInnerWidthText*/);
}

}
Expand Up @@ -117,5 +117,24 @@ public boolean createImageGallery(AbstractBuild<?, ?> build, BuildListener liste
}
return true;
}


public Object readResolve() {
Integer imageWidth = getImageWidth();
String width = getImageWidthText();
if (imageWidth != null && imageWidth > 0) {
width = Integer.toString(imageWidth);
}
Integer imageInnerWidth = getImageInnerWidth();
String innerWidth = getImageInnerWidthText();
if (imageInnerWidth != null && imageInnerWidth > 0) {
innerWidth = Integer.toString(imageInnerWidth);
}
return new InFolderComparativeArchivedImagesGallery(
getTitle(),
getBaseRootFolder(),
width,
innerWidth,
isMarkBuildAsUnstableIfNoArchivesFound());
}

}
Expand Up @@ -23,13 +23,6 @@
*/
package org.jenkinsci.plugins.imagegallery.comparative;

import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.model.BuildListener;
import hudson.model.Result;
import hudson.model.AbstractBuild;

import java.io.File;
import java.io.IOException;
import java.util.List;
Expand All @@ -39,6 +32,13 @@
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;

import hudson.Extension;
import hudson.FilePath;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.Result;

/**
* An image gallery of archived artifacts Comparing same files in different folders.
*
Expand All @@ -48,11 +48,7 @@
public class MultipleFolderComparativeArchivedImagesGallery extends ComparativeArchivedImagesGallery {

/*
<<<<<<< HEAD
* serial UID.
=======
* serial version UID.
>>>>>>> [JENKINS-23772] Use String for image width rather than ints
*/
private static final long serialVersionUID = -4861153536599621098L;

Expand Down Expand Up @@ -125,5 +121,23 @@ public boolean createImageGallery(AbstractBuild<?, ?> build, BuildListener liste
}
return true;
}


public Object readResolve() {
Integer imageWidth = getImageWidth();
String width = getImageWidthText();
if (imageWidth != null && imageWidth > 0) {
width = Integer.toString(imageWidth);
}
Integer imageInnerWidth = getImageInnerWidth();
String innerWidth = getImageInnerWidthText();
if (imageInnerWidth != null && imageInnerWidth > 0) {
innerWidth = Integer.toString(imageInnerWidth);
}
return new MultipleFolderComparativeArchivedImagesGallery(
getTitle(),
getBaseRootFolder(),
width,
innerWidth,
isMarkBuildAsUnstableIfNoArchivesFound());
}
}
Expand Up @@ -147,5 +147,17 @@ public boolean createImageGallery(AbstractBuild<?, ?> build, BuildListener liste
}
return true;
}


public Object readResolve() {
Integer imageWidth = getImageWidth();
String width = getImageWidthText();
if (imageWidth != null && imageWidth > 0) {
width = Integer.toString(imageWidth);
}
return new ArchivedImagesGallery(getTitle(),
getIncludes(),
width,
isMarkBuildAsUnstableIfNoArchivesFound());
}

}
Expand Up @@ -27,6 +27,8 @@

import java.io.Serializable;

import org.jenkinsci.plugins.imagegallery.comparative.ComparativeImagesGalleryBuildAction;

/**
* A project action with the list of archived image file names
* to be displayed.
Expand All @@ -52,7 +54,7 @@ public class ArchivedImagesGalleryBuildAction implements Action, Serializable {
* The image width.
*/
@Deprecated
private int imageWidth;
private Integer imageWidth;
/**
* The image width.
*/
Expand Down Expand Up @@ -135,4 +137,13 @@ public String getImageWidthText() {
return imageWidthText;
}

public Object readResolve() {
String width =
(imageWidth != null && imageWidth > 0) ? Integer.toString(imageWidth) : "0";
return new ArchivedImagesGalleryBuildAction(
title,
images,
width /*imageWidthText*/);
}

}
Expand Up @@ -13,7 +13,7 @@
<li>
<a href="test" class="leaf">
<j:forEach items="${node.value.leafs}" var="img" varStatus="st">
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidth}" />
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidthText}" />
</j:forEach>
</a>
</li>
Expand All @@ -25,9 +25,9 @@
<span>Compared images : ${i.key}</span>
<a class='gallery' rel="${i.key}" href="artifact/${img.name}" title="${img.name}">
<j:choose>
<j:when test="${from.imageWidth > 0}">
<j:when test="${from.imageWidthText > 0}">
<j:forEach items="${i.value}" var="img">
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidth}" />
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidthText}" />
</j:forEach>
</j:when>
<j:otherwise>
Expand Down
Expand Up @@ -6,13 +6,13 @@
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery("a.leaf").each(function(idx, el) {
var html = jQuery(el).clone().find('img').attr("width", ${from.imageInnerWidth}).end().html();
var html = jQuery(el).clone().find('img').attr("width", ${from.imageInnerWidthText}).end().html();

jQuery(el).colorbox({
inline: false,
photo: true,
close: '${%Close}',
innerWidth: Math.min((2 * ${from.imageInnerWidth}) + 25, jQuery(window).width() - 50),
innerWidth: Math.min((2 * ${from.imageInnerWidthText}) + 25, jQuery(window).width() - 50),
height: '100%',
html: '<div style="overflow: auto; float: left;">' + html + "</div>"
});
Expand All @@ -24,7 +24,7 @@
"animation" : 0
}
});
tree.find('.leaf').css('height', ${from.imageWidth} + 10);
tree.find('.leaf').css('height', ${from.imageWidthText} + 10);


});
Expand Down
Expand Up @@ -17,17 +17,8 @@
<link href="${rootURL}/plugin/image-gallery/css/plugin.css" type="text/css" rel="stylesheet" />
<h2>${from.title}</h2>
<j:forEach items="${from.images}" var="i" varStatus="st">
<j:choose>
<j:when test="${from.imageWidth > 0}">
<a class='gallery' href="artifact/${i}" title="${i}">
<img src="artifact/${i}" title="Image ${st.index}" width="${from.imageWidth}" />
</a>
</j:when>
<j:otherwise>
<a class='gallery' href="artifact/${i}" title="${i}">
<img src="artifact/${i}" title="Image ${st.index}" />
</a>
</j:otherwise>
</j:choose>
<a class='gallery' href="artifact/${i}" title="${i}">
<img src="artifact/${i}" title="Image ${st.index}" width="${from.imageWidthText}" />
</a>
</j:forEach>
</j:jelly>
Expand Up @@ -7,7 +7,7 @@
jQuery("a.gallery").each(function(idx, el) {
//alert(jQuery(el).html());

var html = jQuery(el).clone().find('img').attr("width", ${from.imageInnerWidth}).end().html();
var html = jQuery(el).clone().find('img').attr("width", ${from.imageInnerWidthText}).end().html();

jQuery(el).colorbox({
inline: false,
Expand All @@ -26,23 +26,11 @@
<h2>${from.title}</h2>
<j:forEach items="${from.images}" var="i" varStatus="st">
<div><h4>Compared images : ${i.key}</h4>
<j:choose>
<j:when test="${from.imageWidth > 0}">
<a class='gallery' rel="${i.key}" href="artifact/${img.name}" title="${img.name}">
<j:forEach items="${i.value}" var="img">
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidth}" />
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" width="${from.imageWidthText}" />
</j:forEach>
</a>
</j:when>
<j:otherwise>
<a class='gallery' rel="${i.key}" href="artifact/${img.name}" title="${img.name}">

<j:forEach items="${i.value}" var="img">
<img src="artifact/${img.name}" title="Root: ${img.baseRoot}" />
</j:forEach>
</a>
</j:otherwise>
</j:choose>
</div>
</j:forEach>
</j:jelly>

0 comments on commit 8128c33

Please sign in to comment.