Skip to content
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
4 changes: 4 additions & 0 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,10 @@ public static SimplePageDecorator getSimplePageDecorator() {
return SimplePageDecorator.first();
}

public static List<SimplePageDecorator> getSimplePageDecorators() {
return SimplePageDecorator.all();
}

public static List<Descriptor<Cloud>> getCloudDescriptors() {
return Cloud.all();
}
Expand Down
20 changes: 13 additions & 7 deletions core/src/main/java/jenkins/model/SimplePageDecorator.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
*/
package jenkins.model;

import hudson.DescriptorExtensionList;
import hudson.ExtensionPoint;
import hudson.model.Describable;
import hudson.model.Descriptor;

import java.util.List;

/**
* Participates in the rendering of the login page
*
Expand Down Expand Up @@ -56,17 +58,21 @@ public final String getUrl() {
return "descriptor/"+clazz.getName();
}

/**
* Returns all login page decorators.
* @since TODO
*/
public static List<SimplePageDecorator> all() {
return Jenkins.get().getDescriptorList(SimplePageDecorator.class);
}

/**
* The first found LoginDecarator, there can only be one.
* @return the first found {@link SimplePageDecorator}
*/
public static SimplePageDecorator first(){
DescriptorExtensionList<SimplePageDecorator, SimplePageDecorator> descriptorList = Jenkins.getInstanceOrNull().<SimplePageDecorator, SimplePageDecorator>getDescriptorList(SimplePageDecorator.class);
if (descriptorList.size() >= 1) {
return descriptorList.get(0);
} else {
return null;
}
List<SimplePageDecorator> decorators = all();
return decorators.isEmpty() ? null : decorators.get(0);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ THE SOFTWARE.
<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${data.errorMessage!=null ? 'danger' : 'normal'}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>
<html lang="${request.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" resURL="${resURL}">
<title>${%Create an account! [Jenkins]}</title>
Expand Down Expand Up @@ -292,6 +293,11 @@ THE SOFTWARE.
}
</script>
</j:if>
<div class="footer">
<j:forEach var="decorator" items="${simpleDecorators}">
<st:include it="${decorator}" page="simple-footer.jelly" optional="true"/>
</j:forEach>
</div>
</form>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/resources/jenkins/model/Jenkins/login.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ THE SOFTWARE.
<!-- in case of error we want to surround the form elements with an error hint -->
<j:set var="inputClass" value="${error ? 'danger' : 'normal'}"/>
<j:set var="simpleDecorator" value="${h.simplePageDecorator}"/>
<j:set var="simpleDecorators" value="${h.simplePageDecorators}"/>
<!-- real deal starting here -->
<html lang="${request.getLocale().toLanguageTag()}">
<head data-rooturl="${rootURL}" data-resurl="${resURL}" resURL="${resURL}">
Expand Down Expand Up @@ -145,8 +146,9 @@ THE SOFTWARE.
</j:forEach>

<div class="footer">

<st:include it="${simpleDecorator}" page="simple-footer.jelly" optional="true"/>
<j:forEach var="decorator" items="${simpleDecorators}">
<st:include it="${decorator}" page="simple-footer.jelly" optional="true"/>
</j:forEach>
</div>

</div>
Expand Down
2 changes: 2 additions & 0 deletions core/src/test/java/hudson/UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;

Expand Down Expand Up @@ -352,6 +353,7 @@ public void testDeleteContentsRecursive() throws Exception {
}

@Test
@Ignore("Frequently flaky test")
public void testDeleteContentsRecursive_onWindows() throws Exception {
Assume.assumeTrue(Functions.isWindows());
final File dir = tmp.newFolder();
Expand Down