shetc (31) [Avatar] Offline
#1
Hi Eelco,

I've copied this message from the Wicket user forum as no one is responding. Since
you are documented as the author, I was hoping you might be able to help me.

I've had success using the TextTemplateHeaderContributor.forJavaScript method but
can't get the equivalent TextTemplateHeaderContributor.forCss method to work. Here
are some snippets:

From CSS:
<code>
.someClass {
     background: #fff url('${brand}/someImage.jpg') 100% 100% no-repeat;
}
</code>

From Java:
IModel skinModel = new AbstractReadOnlyModel() {
     private static final long serialVersionUID = 1L;
     @Override
     public Map getObject() {
          Map<String, CharSequence> variables =
               new HashMap<String, CharSequence>(1);
          variables.put("brand", getStyle());
          return variables;
     }
};
add(TextTemplateHeaderContributor.forCss(
     MyApplication.class, "skins/style.css", skinModel));

The problem is that the substitution seems to fail and the someImage.jpg file is not drawn. Any ideas on what I am doing wrong?

Thanks,
Steve