Search code examples
c#asp.net-mvcdojoepiserver

How to implement dijit in EPiServer 7


I've been trying to implement widgets with Dojos Dijit in EPiServer 7. I know how dojo/dijit works, but how do I implement it in EPiServer CMS 7? The project I have is a MVC project. I've tried looking at this guide (http://world.episerver.com/Blogs/Linus-Ekstrom/Dates/2012/10/Creating-a-Dojo-based-component/), but I can't find the namespaces which he is using in his C# class. I've tried to find other tutorials, but I have had little luck.

Does anyone know how to do this or can link me to a tutorial?


Solution

  • I posted the same question on EPiServers forums and figured it out.

    What was wrong was the data in the WidgetType property.

    [Component(
        PlugInAreas = "/episerver/cms/assets",
        Categories = "cms",
        WidgetType = "mycomponents.testModule", //was wrong, I had to define "mycomponents".
        Title = "test component",
        Description = "A componenet")]
    public class testModuleComponent
    {
    }
    

    I had to define a namespace that dojo would recognize. I did this in module.config. This is my module.config:

    <?xml version="1.0" encoding="utf-8"?>
    <module>
      <dojoModules>
        <add name="mycomponents" path="~/ClientResources/Scripts" />
      </dojoModules>
    </module>
    

    Scripts is the folder with the dojo script. I define ~/ClientResources/Scripts as root of a namespace with the name mycomponents.

    EPiServer automatically includes dojo for you, so you dont have to do it yourself.

    See this thread: http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=63255&pageIndex=1#reply.