This project is read-only.

Style.Require("jQueryUI_Widget") does not work

Topics: Writing themes
Feb 23, 2011 at 1:57 PM
Edited Feb 23, 2011 at 2:37 PM

Do I have to insert any dependency configuration somewhere (Theme.txt)?

I just get:


[InvalidOperationException: A 'stylesheet' named 'jQueryUI_Widget' could not be found.]
   Orchard.UI.Resources.ResourceManager.BuildRequiredResources(String resourceType) +561
   Orchard.Core.Shapes.CoreShapes.WriteResources(Object Display, TextWriter Output, String resourceType, Nullable`1 includeLocation, Nullable`1 excludeLocation) +547
   CallSite.Target(Closure , CallSite , CoreShapes , Object , TextWriter , String , Object , Object ) +516
   Orchard.Core.Shapes.CoreShapes.StylesheetLinks(Object Display, TextWriter Output) +564


Just Require("jQuery") doesn't work, too.

Adding some precompiled helper code to Themes (like Telerik) also is totally ignored so Themes seem to be very restricted Modules.

Feb 23, 2011 at 7:48 PM

Actually, themes can do everything modules can do and more so no they are not restricted. It's just that you need a csproj in there. That csproj should have references to the assemblies that you need to use.

Feb 23, 2011 at 9:12 PM

I always have been using full C# projects with .csproj files. But in themes I cannot reference any class which is not part of an assembly being put in ~/bin. I just put a class Test.cs into the theme (namespace MyCompany.Orchard.Themes.MyTheme) but when using this namespace for example in Content.cshtml I just get a HttpCompileException saying "error CS0246: The type or namespace name 'MyCompany' could not be found".

But at least I found my main error (from title): Of course I should use Script.Require("jQuery").

Feb 23, 2011 at 11:00 PM

And you added references to that project?

Feb 28, 2011 at 9:29 AM
Edited Feb 28, 2011 at 9:30 AM

The code is inside the very same project -- the theme.

I'm sorry to say that I'm very frustrated. None of the code (other than that in .cshtml files) is being used. I copied the ShapeTableProvider from Contoso theme but Content-HomePage is not working, too.

There are just too many undocumented relationships, naming rules, whatever. I have no clue.

Feb 28, 2011 at 9:07 PM

There is something wrong with your project file: for some reason it's not getting picked up. Does it have the same name as the theme?

Mar 1, 2011 at 8:57 AM

I feel like having déjà vus when I'm asking that "the name of a theme" is not the text after "Name: " in Theme.txt but the folder name where the module/theme is being stored?

At least now it works, using the folder name for the c# project name.

Mar 1, 2011 at 10:26 PM

You're right, I should have said the theme id.

Mar 4, 2011 at 10:10 PM

I BTW found 1 issue so far when putting typical module stuff into a theme: After having added a Migration class I now have a notice "Some features need to be upgraded: MyCustomTheme" inside the dashboard; but there is no link to apply the upgrade while the theme is the current one: I have to enable another theme, set that one as the current, upgrade MyCustomTheme, set MyCustomTheme again as current and disable the other theme again.

Mar 7, 2011 at 1:03 PM
bertrandleroy wrote:

Actually, themes can do everything modules can do and more so no they are not restricted.

And another bug which disqualifies themes from being used like a module:

I can register a new content part and even the driver for the editor gets called. But the shape is never acquired because the entry inside is ignored and so the editor is never being shown. [I just copied the <Place>-node into the file of a totally different module (without changing anything else) and then it finally appeared.]

Mar 9, 2011 at 12:40 AM

Please file bugs for those.