Community
Participate
Working Groups
Commands and widgets in the header and footer regions have various prerequisites (both scripts and dojo requires). This means that each HTML page containing the headers and footers needs to express those dependencies. This isn't modular or scalable. We need some way to inject the dependencies along with the header and footer, so each page doesn't need to know implementation details of the header/footer content. The concrete example in bug 339509, is that each page needs to add a dojo require on dijit.form.TextBox in order for the "Open Resource" command to work.
Just to document here, to fix the "Open Resource" problem I had to add a couple of dojo requires on each page, and ensure the dojo module page had the scripts required by the header: var djConfig = { isDebug : true, modulePaths : {'widgets': '/js/widgets'}, parseOnLoad : true }; Multiply by about ten pages...
For this specific case, I consider this bug to be a symptom of the bigger problem described in bug 340019. Rather than have us focus on dependency management to solve this problem, I'd like to see us come up with a real story for including one set of html/js in all the pages.
This is fixed by Simon's changes for require js. The js files for the global header and footer now explicitly state their dependencies, so the dependency on Open Resource Dialog is stated in globalCommands.js (Just now OpenResource was broken when invoked from the editor because dijit.form.TextBox was missing as a requirement. Added it as a requirement of open resource dialog. Now it works. Cool.)