Static resources shouldn't be loaded for every page
|Reported by:||rjollos||Owned by:||ChrisNelson|
The static resources of this macro are loaded for every page, even on pages that the macro is not used. For example, on a ticket page (with no instances of the macro), I see the following:
<link rel="stylesheet" href="/chrome/tracjsgantt/jsgantt.css" type="text/css" /> <link rel="stylesheet" href="/chrome/tracjsgantt/tracjsgantt.css" type="text/css" />
Also, there are two components that must be enabled for this plugin, but I can't see any circumstance in which only one component could be enabled without enabling the other.
My suggestions are:
- Don't implement IRequestFilter. Add the stylesheets and scripts in expand_macro.
- Inherit from WikiMacroBase rather than Component.
Dose that make sense, or am I missing something? I can try this out and provide a patch very shortly if it makes sense to you. I did the exact same cleanup for the NoteBoxPlugin recently in #9739, and had some discussion with hasienda about these issues.