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

Custom style parameter (light:administration:custom-style in web.xml) #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ public interface LightAdminConfiguration {

boolean isFileStreamingEnabled();

String getCustomStylePath();
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class StandardLightAdminConfiguration implements LightAdminConfiguration
private final boolean fileStreaming;
private final String basePackage;
private final boolean demoMode;
private String customStylePath;

public StandardLightAdminConfiguration(ServletContext servletContext) {
this.basePackage = servletContext.getInitParameter(LIGHT_ADMINISTRATION_BASE_PACKAGE);
Expand All @@ -59,6 +60,8 @@ public StandardLightAdminConfiguration(ServletContext servletContext) {
} else {
this.securityLogoutUrl = servletContext.getContextPath() + defaultIfBlank(servletContext.getInitParameter(LIGHT_ADMINISTRATION_SECURITY_LOGOUT_URL), "#");
}

this.customStylePath = servletContext.getInitParameter(LIGHT_ADMINISTRATION_CUSTOM_STYLE);
}

@Override
Expand Down Expand Up @@ -110,6 +113,11 @@ public boolean isDemoMode() {
return demoMode;
}

@Override
public String getCustomStylePath() {
return customStylePath;
}

@Override
public String getSecurityLogoutUrl() {
return securityLogoutUrl;
Expand All @@ -136,4 +144,6 @@ private String helpUrl(ServletContext servletContext) {
private String urlWithoutEndSeparator(String url) {
return url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ public class LightAdminConfigurationUtils {
public static final String LIGHT_ADMINISTRATION_HELP_DEFAULT_URL = "http://lightadmin.org/getting-started/";

public static final String LIGHT_ADMINISTRATION_DEMO_MODE = "light:administration:demo-mode";
public static final String LIGHT_ADMINISTRATION_CUSTOM_STYLE = "light:administration:custom-style";
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ protected void execute(Request request, AttributeContext attributeContext, Globa
super.execute(request, attributeContext, configuration);

addAttribute(attributeContext, "lightAdminConfiguration", lightAdminConfiguration, true);
addAttribute(attributeContext, "customStyle", lightAdminConfiguration.getCustomStylePath(), true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>

<tiles:importAttribute name="screenContext" ignore="true"/>
<tiles:importAttribute name="customStyle" ignore="true"/>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand All @@ -26,6 +27,9 @@
<link rel="stylesheet" type="text/css" href="<light:url value="/styles/main.css"/>">
<link rel="stylesheet" type="text/css" href="<light:url value="/styles/lightadmin.css"/>">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Cuprum">
<c:if test="${not empty (customStyle)}">
<link rel="stylesheet" type="text/css" href="<spring:url value="${customStyle}"/>">
</c:if>

<tiles:insertAttribute name="common-scripts-include"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<param-value>false</param-value>
</context-param>

<!--<context-param>-->
<!--<param-name>light:administration:custom-style</param-name>-->
<!--<param-value>/styles/style.css</param-value>-->
<!--</context-param>-->

<!--<context-param>-->
<!--<param-name>light:administration:security-logout-url</param-name>-->
<!--<param-value>/logout</param-value>-->
Expand Down
5 changes: 5 additions & 0 deletions lightadmin-sandbox/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<param-value>false</param-value>
</context-param>

<!--<context-param>-->
<!--<param-name>light:administration:custom-style</param-name>-->
<!--<param-value>/styles/style.css</param-value>-->
<!--</context-param>-->

<!--<context-param>-->
<!--<param-name>light:administration:security-logout-url</param-name>-->
<!--<param-value>/logout</param-value>-->
Expand Down