New Menu Module

Topics: Administration, Announcements, Customizing Orchard, General, Writing modules
Sep 7, 2011 at 8:53 PM
Edited Sep 7, 2011 at 8:54 PM

Hi everyone, I wanted to announce that I've just published a new menu module that is inspired by the menu editor built into wordpress 3+.  It allows you to create multiple hierarchical menus, has drag & drop ajax editing, and allows you to link to content items.  Before going any further, I want to give credit where it is due: thanks so much to Piotr Szmyd, as several of the implementation details were derived from his Advanced Menu module.  It's great to be able to draw and build upon other people's work.

The module is in the gallery here and the project site is here.  

A couple important notes:

  • This module relies on the search module as well as a related content module that is a work in progress (basically there are many other use cases in which it can be used, so it's really only solid for this specific case).  Since orchard doesn't play nice with inter-module dependencies, please be sure to install these module prior to installing this module.
  • This module won't play nice with the Advanced Menu module, as they both override the same classes and they both modify the "menu"/"menu item" parts in different ways.

This is the initial release of the menu, and there definitely might be some bugs, and there are a handful of features that have not been implemented yet.  They are, in no particular order:

  • Performance/caching
  • Permissions 
  • Localization 
  • Ajax error handling 
  • Logging 
  • Import/Export 
  • Commands 
  • Contained Items
  • Potentially include some default menu javascript/styles.  Part of me feels like this is the responsibility of the theme.

Oh, and here's a screenshot if you're curious:

Sep 7, 2011 at 9:56 PM

Very nice looking. I like the way Wordpress 3 does menu editing. It's a good idea to copy. :)

Coordinator
Sep 8, 2011 at 10:11 PM

Very nice!

Developer
Sep 8, 2011 at 11:30 PM

Wow, seems nice! In my opinion Wordpress excels in terms of UX, to it's no shame to copy it :-).

Sep 9, 2011 at 9:14 AM

Very nice! good job!

Developer
Sep 9, 2011 at 9:58 AM

two thumbs up!

Developer
Sep 9, 2011 at 11:15 AM

Well done! Nice my code could be helpful;)

Sep 9, 2011 at 3:56 PM

Just wanted to toss in another Well Done!

Very clean, usable interface. Love the re-ordering and creation of hierarchical menus with a simple drag and drop!

Sep 29, 2011 at 1:03 PM

I am getting following error when I click on "Manage menus" option:

'ClaySharp.ClayBehaviorCollection' does not contain a definition for 'GetMembers'

in ShapeHelper, "Find" method

I am running it from code in development server on vs2010. Theme is "The Theme machine" if that makes a difference.

Today only took latest source code from codeplex.

Pl help..

 

Sep 29, 2011 at 5:26 PM

BhoomiKakaiya - I am unable to reproduce this on my end.  If you are using sql ce, if you package up your instance and send it to me then I can take a look.

Sep 29, 2011 at 8:20 PM

Thanks for the quick reply..

No I am using Sql Server 2005 on my local notebook. Rest all things are working fine. I have integrated other module like Theme.

Stack Trace is as mentioned below, if that helps..

   at CallSite.Target(Closure , CallSite , Object , Func`1 , Object , Dictionary`2 )   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)   at Util.ShapeHelper.Find(Object model, String name) in d:\Bhoomi\Misc Projects\Orchard\Orchard.Web.1.1.30\Orchard\Modules\SchoolPointe.Menus\Helpers\ShapeHelper.cs:line 14   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)   at ASP._Page_Modules_SchoolPointe_Menus_Views_Editor_Wrapper_MenuItem_Edit_cshtml.Execute() in d:\Bhoomi\Misc Projects\Orchard\Orchard.Web.1.1.30\Orchard\Modules\SchoolPointe.Menus\Views\Editor.Wrapper-MenuItem-Edit.cshtml:line 21   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)   at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)   at Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:line 121   at Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.<>c__DisplayClass24.<>c__DisplayClass26.<Discover>b__14(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:line 109   at Orchard.DisplayManagement.Descriptors.ShapeAlterationBuilder.<>c__DisplayClass3.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:line 55   at Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:line 173   at Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:line 92   at Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:line 71   at Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable`1 parameters) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:line 38   at Orchard.DisplayManagement.Implementation.DisplayHelperFactory.DisplayHelperBehavior.InvokeMember(Func`1 proceed, Object target, String name, INamedEnumerable`1 args) in d:\TeamCity\Projects\Orchard-Default\src\Orchard\DisplayManagement\Implementation\DisplayHelperFactory.cs:line 27   at ClaySharp.ClayBehaviorCollection.<>c__DisplayClasse.<>c__DisplayClass10.<InvokeMember>b__d()   at ClaySharp.ClayBehaviorCollection.Execute(Func`1 proceed, Func`3 linker)   at ClaySharp.ClayBehaviorCollection.InvokeMember(Func`1 proceed, Object self, String name, INamedEnumerable`1 args)   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)   at ASP._Page_Modules_SchoolPointe_Menus_Views_MenuItemAdmin_CreateContentItems_cshtml.Execute() in d:\Bhoomi\Misc Projects\Orchard\Orchard.Web.1.1.30\Orchard\Modules\SchoolPointe.Menus\Views\MenuItemAdmin\CreateContentItems.cshtml:line 4   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)

 

 

Sep 29, 2011 at 8:29 PM

Interesting, are you sure that this happens when you click "manage menus" and not when you click to edit an individual menu?  This view:  ASP._Page_Modules_SchoolPointe_Menus_Views_Editor_Wrapper_MenuItem_Edit_cshtml should not be getting executed on the menu list page...I'll look into it now, but if you can verify on which page this is happening, that would help. Thanks.

Sep 30, 2011 at 5:57 AM

I get the error when I try to add a menu using check box in the left pane, to newly created menu.

Editor
Oct 3, 2011 at 7:48 PM

Any performance metrics compared to AdvancedMenu? Are Menu Items being cached? This was a huge problem before for me.

Oct 3, 2011 at 7:54 PM

In the first version, there has been no performance optimization.  That said, I don't think it will be a significant undertaking.  Hopefully I can get to it soon, otherwise I'm always open to integrate fixes/patch requests into the main repo.

Oct 5, 2011 at 12:31 AM

very nice, thank you!