martin-g / wicket-bootstrap

Apache Wicket components for Twitter Bootstrap - Wicket-Bootstrap is based on Twitter's toolkit (bootstrap) and the Apache Wicket Framework.
https://wicketbootstrap.teliclab.info/
296 stars 162 forks source link

themes and resource handling #349

Open l0rdn1kk0n opened 10 years ago

l0rdn1kk0n commented 10 years ago

we've to improve the theme and resource handling because it leads to some strange behavior.

see also: #347, #345, #344

martin-g commented 10 years ago

de.agilecoders.wicket.core.settings.DefaultThemeProvider#defaultTheme(de.agilecoders.wicket.core.settings.ITheme) is a bit strange - it converts an ITheme to a String (its name) and passes it to de.agilecoders.wicket.core.settings.DefaultThemeProvider#defaultTheme(java.lang.String) where this String is converted back to ITheme

Update: improved with https://github.com/l0rdn1kk0n/wicket-bootstrap/commit/58a8e2280371a388b303a1517d03e1bca32df045

martin-g commented 10 years ago

de.agilecoders.wicket.themes.markup.html.bootstrap.Bootstrap3Theme issues:

Update: fixed with https://github.com/l0rdn1kk0n/wicket-bootstrap/commit/e67a05bff7335b15c316dcfd718d78c976a1ddc5

martin-g commented 10 years ago

It would be nice to get advantage of the new functionality provided by https://issues.apache.org/jira/browse/WICKET-5617

At the moment I have this local patch in wicket-7.0.0-M1 branch:

 --- i/bootstrap-themes/src/main/java/de/agilecoders/wicket/themes/markup/html/bootswatch/BootswatchTheme.java
 +++ w/bootstrap-themes/src/main/java/de/agilecoders/wicket/themes/markup/html/bootswatch/BootswatchTheme.java
@@ -51,10 +51,12 @@ public enum BootswatchTheme implements ITheme {
            if (cdnUrl == null) {
                 cdnUrl = String.format(CDN_PATTERN, getVersion(), name().toLowerCase());
             }
-            response.render(CssHeaderItem.forReference(new UrlResourceReference(Url.parse(cdnUrl))));
+            CssHeaderItem item = CssHeaderItem.forReference(new UrlResourceReference(Url.parse(cdnUrl)),
+                    null, null, null).setId("wb-theme");
+            response.render(item);
         }
         else {
-            response.render(CssHeaderItem.forReference(reference));
+            response.render(CssHeaderItem.forReference(reference).setId("wb-theme"));
         }

But I face the following problems:

Update: Improved with 76c8d36 in wicket-7.0.0-M1 branch (the living branch against Wicket 7.0.0-SNAPSHOT).