Skip to content

Commit

Permalink
[FIXED JENKINS-44797] Switch to adjuncts. (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick authored and James William Dumay committed Oct 19, 2017
1 parent 60da2ee commit 3d59069
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 98 deletions.
8 changes: 0 additions & 8 deletions src/main/java/hudson/plugins/favorite/assets/Asset.java

This file was deleted.

Expand Up @@ -8,7 +8,6 @@
import hudson.model.Descriptor;
import hudson.model.UserProperty;
import hudson.model.UserPropertyDescriptor;
import hudson.plugins.favorite.assets.Asset;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
Expand Down Expand Up @@ -151,7 +150,4 @@ private void removeFavoritesWhichDoNotExist() {
}
}

public Class getAssetClass() {
return Asset.class;
}
}
42 changes: 42 additions & 0 deletions src/main/resources/hudson/plugins/favorite/assets.css
@@ -0,0 +1,42 @@
/** ICONS **/

.icon-fav-active,
.icon-fav-inactive {
display:block;
border:0px;
background-repeat: no-repeat;
}
.icon-fav-active {
background-image: url(../../../../../images/48x48/star-gold.png);
}
.icon-fav-inactive {
background-image: url(../../../../../images/48x48/star.png);
}


/** SIZES **/

.icon-fav-inactive.icon-sm,
.icon-fav-active.icon-sm {
width:16px;
height:16px;
background-size: 15px 15px;
}
.icon-fav-inactive.icon-md,
.icon-fav-active.icon-md {
width:24px;
height:24px;
background-size: 23px 23px;
}
.icon-fav-inactive.icon-lg,
.icon-fav-active.icon-lg {
width:32px;
height:32px;
background-size: 31px 31px;
}
.icon-fav-inactive.icon-xlg,
.icon-fav-active.icon-xlg {
width:48px;
height:48px;
background-size: 47px 47px;
}
22 changes: 22 additions & 0 deletions src/main/resources/hudson/plugins/favorite/assets.js
@@ -0,0 +1,22 @@
function toggleFavorite(job, a) {
new Ajax.Request(rootURL + "/plugin/favorite/toggleFavorite?job=" + job, {method: 'POST'});
var favIcon = document.getElementById("fav_" + job);
if (favIcon.classList.contains("icon-fav-inactive")) {
favIcon.classList.add("icon-fav-active");
favIcon.classList.remove("icon-fav-inactive");
hoverNotification("Favorite added", a.parentNode);
window.dispatchEvent(new CustomEvent('favorite-plugin-icon-change', {
transition: "active-to-inactive",
job: job
}));
} else {
favIcon.classList.add("icon-fav-inactive");
favIcon.classList.remove("icon-fav-active");
hoverNotification("Favorite deleted", a.parentNode);
window.dispatchEvent(new CustomEvent('favorite-plugin-icon-change', {
transition: "inactive-to-active",
job: job
}));
}
return false;
}
47 changes: 0 additions & 47 deletions src/main/resources/hudson/plugins/favorite/assets/css.jelly

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/resources/hudson/plugins/favorite/assets/javascript.jelly

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,7 +1,6 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler">
<st:include page="/hudson/plugins/favorite/assets/css.jelly" />
<st:include page="/hudson/plugins/favorite/assets/javascript.jelly" />
<st:adjunct includes="hudson.plugins.favorite.assets"/>
<j:if test="${it.isLoggedIn()}">
<th>${%Fav}</th>
</j:if>
Expand Down
@@ -1,8 +1,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:include page="/hudson/plugins/favorite/assets/css.jelly" class="${instance.assetClass}" />
<st:include page="/hudson/plugins/favorite/assets/javascript.jelly" class="${instance.assetClass}" />
<st:adjunct includes="hudson.plugins.favorite.assets"/>
<f:block>
<table id="favorites">
<j:forEach var="favorite" items="${instance.favorites}">
Expand Down

0 comments on commit 3d59069

Please sign in to comment.