Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Churchley 272 posts 1258 karma points c-trib
    Feb 05, 2018 @ 12:35
    John Churchley
    0

    Creating Action Menu in Custom Section View

    Hi,

    Does anyone know of an example to get the action menu to appear in a custom section view using the umbEditorHeader directive?

    Trying to create the correct "menu"

    https://our.umbraco.org/apidocs/ui/#/api/umbraco.directives.directive:umbEditorHeader

      <umb-editor-header
        name="vm.Name"
        tabs="vm.content.tabs"
        hide-alias="true"
        hide-description="true"
        hide-icon="true"
        menu="vm.content.menu">
      </umb-editor-header>
    

    Action Menu Image

    Directive File:

    https://github.com/umbraco/Umbraco-CMS/blob/e0025db56d52b770d2b3aedbd48a3b804fd15ef0/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Feb 05, 2018 @ 13:32
    Dave Woestenborghs
    0

    Hi John,

    Do you have any actions set on your item ? I think if you set them on the tree node they will automagically appear :-)

    Dave

  • John Churchley 272 posts 1258 karma points c-trib
    Feb 05, 2018 @ 14:01
    John Churchley
    0

    Hi Dave,

    I have items set on the menu. Might be missing something but not sure it's that simple as it's a bespoke view in a custom section.

    John

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Feb 05, 2018 @ 14:21
    Dave Woestenborghs
    0

    Hi John,

    I was totally wrong. Just checked a PR on Umbraco where I know I had this working.

    In your controller you need to add this :

    vm.page.menu = {};
    vm.page.menu.currentSection = appState.getSectionState("currentSection");
    vm.page.menu.currentNode = null;
    

    You will probably load some data from your backend. When handling the response you need to do this :

     editorState.set(data);
     navigationService.syncTree({ tree: "your tree alias", path: data.path, forceReload: true }).then(function (syncArgs) {
     vm.page.menu.currentNode = syncArgs.node;
    });
    

    See this for a reference : https://github.com/umbraco/Umbraco-CMS/pull/2159/files#diff-c02e14235b6e9f06b1c27c454dc7049c

    Then in your view :

     <umb-editor-header
        name="vm.Name"
        tabs="vm.content.tabs"
        hide-alias="true"
        hide-description="true"
        hide-icon="true"
        menu="vm.page.menu">
      </umb-editor-header>
    

    Dave

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies