cancel
Showing results for 
Search instead for 
Did you mean: 

Including Resources via *.head.ftl

rob_h
Champ in-the-making
Champ in-the-making
Hey Guys,

This is quite possibly a SURF question, but as I've hit it doing Share development I'll ask here.

I've created a number of custom dashlets for Share; most of these are displayed on User and Site dashboards and work fine.  However it seems that when I want to call dashlets as modal dialogs - using the Alfresco SimpleDialog helper class - any resources I am including in the *.head.ftl file are not imported.  I'm working around this by importing resources via the "parent" component that calls the dialog, so that they are already available when the dialog is rendered.  Is this a known issue, or have I misunderstood a key SURF paradigm?

Thanks,
Rob
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
When you request a script that has a .head.ftl part, the framework will ensure the resources are in the <head> section of the response.

However, for an AJAX request (such as from the SimpleDialog module), browsers don't interpret the response as a "normal" page load and have to be told what to do. Currently, we support <script> blocks within AJAX responses (e.g. for setting i18n messages, etc.) but not dynamic loading of .js and .css files. It's on my list to add, but because it's a non-trivial problem to solve, it's not been prioritised yet.

It's the reason why, for example, the documentlist.get.head.ftl file contains the .js and .css for all the actions UIs, such as assign workflow, copy to, etc.

Thanks,
Mike

rob_h
Champ in-the-making
Champ in-the-making
Thanks for your response, Mike.

Rob