Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an icon for javadocs #41

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/hudson/tasks/JavadocArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*/
public class JavadocArchiver extends Recorder implements SimpleBuildStep {

static final String HELP_PNG = "help.png";
static final String JAVADOC_ICON = "/plugin/javadoc/icons/javadoc.svg";

/**
* Path to the Javadoc directory in the workspace.
Expand Down Expand Up @@ -147,7 +147,7 @@ public String getDisplayName() {
public String getIconFileName() {
File dir = dir();
if(dir != null && dir.exists())
return HELP_PNG;
return JAVADOC_ICON;
else
// hide it since we don't have javadoc yet.
return null;
Expand All @@ -158,7 +158,7 @@ public String getIconFileName() {
*/
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
final File basedir = dir();
DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(this, new FilePath(basedir), getTitle(), HELP_PNG, false);
DirectoryBrowserSupport dbs = new DirectoryBrowserSupport(this, new FilePath(basedir), getTitle(), JAVADOC_ICON, false);

String index = alternativeIndexFile(basedir);
if (index != null) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/index.jelly
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
This plugin adds Javadoc support to Jenkins.
</div>
46 changes: 46 additions & 0 deletions src/main/webapp/icons/javadoc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/test/java/hudson/tasks/JavadocArchiverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static final class MakeDocBuilder extends TestBuilder {

private void assertShowsDoc(Action a, String baseUrl, String text) throws Exception {
assertNotNull(a);
assertEquals(JavadocArchiver.HELP_PNG, a.getIconFileName());
assertEquals(JavadocArchiver.JAVADOC_ICON, a.getIconFileName());
JenkinsRule.WebClient wc = r.createWebClient();
wc.getOptions().setJavaScriptEnabled(false); // Should not be
assertThat(wc.goTo(baseUrl + a.getUrlName() + "/").getWebResponse().getContentAsString(), containsString(text));
Expand Down