Skip to content

Commit

Permalink
Merge pull request #25 from christopher-szu/F70-ZK-2931
Browse files Browse the repository at this point in the history
fixed ZK-2931: Atlantic theme @import google fonts
  • Loading branch information
wenninghsu committed Nov 4, 2015
2 parents 7893d6d + 83e3635 commit 77278fb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
25 changes: 25 additions & 0 deletions src/main/java/org/zkoss/theme/atlantic/AtlanticThemeProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.zkoss.theme.atlantic;

import java.util.Collection;
import java.util.List;

import org.zkoss.html.StyleSheet;
import org.zkoss.lang.Library;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zul.theme.StandardThemeProvider;

public class AtlanticThemeProvider extends StandardThemeProvider {

/** Library property key. */
private static final String DONT_USE_GOOGLE_FONT = "org.zkoss.theme.atlantic.useGoogleFont.disabled";

@Override
public Collection<Object> getThemeURIs(Execution exec, List<Object> uris) {
if (!Boolean.parseBoolean(Library.getProperty(DONT_USE_GOOGLE_FONT))) { //false by default
//ZK-2931 can't start the url with "//", encodeURL will prepend
//current context path if no scheme were given
uris.add(new StyleSheet(exec.getScheme() + "://fonts.googleapis.com/css?family=Open+Sans", "text/css"));
}
return super.getThemeURIs(exec, uris);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ public class AtlanticThemeWebAppInit implements WebAppInit {
private final static int ATLANTIC_PRIORITY = 1000;

public void init(WebApp wapp) throws Exception {
//ZK-2931 custom theme provider and library property for turning on/off the usage of google font
wapp.getConfiguration().setThemeProvider(new AtlanticThemeProvider());
Themes.register(ATLANTIC_NAME, ATLANTIC_DISPLAY, ATLANTIC_PRIORITY);
String edition = WebApps.getEdition();
if ("EE".equals(edition)) {
Themes.register(ResponsiveThemeRegistry.TABLET_PREFIX + ATLANTIC_NAME, ATLANTIC_DISPLAY, ATLANTIC_PRIORITY);
}
}

}
2 changes: 0 additions & 2 deletions src/main/resources/web/atlantic/zul/less/norm.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
@import "~./zul/less/_reset.less";
// Font-Awesome 3.1.1
@import "~./zul/less/font/_all.less";
// Google Font
@import ~"url(//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700)";

html, body {
height: 100%;
Expand Down
3 changes: 2 additions & 1 deletion zkdoc/release-note
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
--------
Atlantic 1.0.7
* Features:

ZK-2931: Atlantic theme @import google fonts

* Bugs:

* Upgrade Notes:
Expand Down

0 comments on commit 77278fb

Please sign in to comment.