I'm currently writing my own module that needs some scripts to be loaded on all pages, both on the front-end and the dashboard, where the user is authorized to edit content. I've written an implementation of the IResultFilter that adds a shape to the 'tail' zone in the site's theme.
The shape is added to the page correctly and all is OK except for one thing. In the same shape I'm also trying to call Script.Require on a few scripts that I've added to the ResourceManifest, but they're not being loaded in to the page.
@{
Script.Require("OrchardTinyMce");
Script.Require("jQueryColorBox");
}
If I place this same code in a view that's not rendered using my IResultsFilter implementation then they are added to the page. I'd rather keep this bit of code in it's current view though as two alternates further down the line which require the same scripts and I don't really want to duplicate it.
Does anyone have any ideas how I get the scripts to register? Thanks in advance for you help.
I've worked out how to do this. I've just injected IResourceManager into my HtmlFilter and then added the scripts as follows: