mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-08 17:46:03 +00:00
Merge branch 'pull-822'
This commit is contained in:
commit
1ecf4b14d7
4 files changed
+60
-7
No files matched your search
@@ -37,7 +37,15 @@ public class Root implements RootAction, ModelObjectWithContextMenu {
|
||||
public List<UISample> getAll() {
|
||||
return UISample.all();
|
||||
}
|
||||
|
||||
public List<UISample> getAllGroovy() {
|
||||
return UISample.getGroovySamples();
|
||||
}
|
||||
|
||||
public List<UISample> getAllOther() {
|
||||
return UISample.getOtherSamples();
|
||||
}
|
||||
|
||||
public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
|
||||
return new ContextMenu().addAll(getAll());
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package jenkins.plugins.ui_samples;
|
||||
|
||||
import static org.apache.commons.io.IOUtils.copy;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Describable;
|
||||
import jenkins.model.Jenkins;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.io.IOUtils.copy;
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -80,6 +81,33 @@ public abstract class UISample implements ExtensionPoint, Action, Describable<UI
|
||||
return Jenkins.getInstance().getExtensionList(UISample.class);
|
||||
}
|
||||
|
||||
public static List<UISample> getGroovySamples() {
|
||||
List<UISample> r = new ArrayList<UISample>();
|
||||
for (UISample uiSample : UISample.all()) {
|
||||
for (SourceFile src : uiSample.getSourceFiles()) {
|
||||
if (src.name.contains("groovy")) {
|
||||
r.add(uiSample);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public static List<UISample> getOtherSamples() {
|
||||
List<UISample> r = new ArrayList<UISample>();
|
||||
OUTER:
|
||||
for (UISample uiSample : UISample.all()) {
|
||||
for (SourceFile src : uiSample.getSourceFiles()) {
|
||||
if (src.name.contains("groovy")) {
|
||||
r.add(uiSample);
|
||||
continue OUTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
Demonstration of UI controls available in Jenkins based on Stapler, Jelly, etc.
|
||||
Demonstration of UI controls available in Jenkins based on Stapler, Jelly, Groovy and etc.
|
||||
</div>
|
||||
@@ -27,8 +27,10 @@ THE SOFTWARE.
|
||||
<l:main-panel>
|
||||
<h1>UI Samples</h1>
|
||||
|
||||
<h2>Groovy Templates</h2>
|
||||
|
||||
<table>
|
||||
<j:forEach var="s" items="${it.all}">
|
||||
<j:forEach var="s" items="${it.allGroovy}">
|
||||
<t:summary icon="document.gif"
|
||||
href="${s.urlName}" iconOnly="true">
|
||||
<div class="link"><a href="${href}">${s.displayName}</a></div>
|
||||
@@ -38,6 +40,21 @@ THE SOFTWARE.
|
||||
</t:summary>
|
||||
</j:forEach>
|
||||
</table>
|
||||
|
||||
<h2>Jelly Templates</h2>
|
||||
|
||||
<table>
|
||||
<j:forEach var="s" items="${it.allOther}">
|
||||
<t:summary icon="document.gif"
|
||||
href="${s.urlName}" iconOnly="true">
|
||||
<div class="link"><a href="${href}">${s.displayName}</a></div>
|
||||
<div style="color:gray; text-decoration:none;">
|
||||
<j:out value="${s.description}"/>
|
||||
</div>
|
||||
</t:summary>
|
||||
</j:forEach>
|
||||
</table>
|
||||
|
||||
</l:main-panel>
|
||||
</l:layout>
|
||||
</j:jelly>
|
||||
Reference in new issue
Block a user