Copied to clipboard

Flag this post as spam?

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


  • Simone Chiaretta 134 posts 541 karma points c-trib
    Feb 18, 2016 @ 20:41
    Simone Chiaretta
    0

    How to "packages" a custom action that I added to the Menu tree?

    Hi,

    I made a small package that adds a new MenuItem to the action menu, but I don't understand how to componentize it.

    The package is made of:

    1. EventHandler that addes the MenuItem
    2. Html View for the dialog
    3. javascript files for the controller and services
    4. Backoffice API

    1 and 4 will be in the dlls so no problem with those, but where can I store the view and the js files?

    By default the view should be placed in Umbraco/views/content, but not sure this is the best place for a custom view. I'd rather put it into the App_Plugins folder. But how can I specify the location when I add the MenuItem?

    And how can I add a new javascript file that is loaded by Umbraco even if it's not part of a property editor?

  • Simone Chiaretta 134 posts 541 karma points c-trib
    Feb 18, 2016 @ 21:08
    Simone Chiaretta
    101

    Found the solution myself :)

    I can put all my files in a App_Plugin folder anyway, and specify a package.manifest file with the js and css I need. This works also if there is property editor involved.

    Then, when I add the MenuItem, instead of relying on convention I can specify the view to call:

    var m = new Umbraco.Web.Models.Trees.MenuItem("myAction", "My Custom Action");
    m.AdditionalData.Add("actionView", "/app_plugins/myplugin/myview.html");
    
  • Ian 178 posts 752 karma points
    Feb 18, 2016 @ 21:11
    Ian
    0

    The package manifest for a plugin you create in app_plugins doesn't i think need to contain the definition for a property editor, just use the keys in the json schema for css and js resources and they will load. You can do this sort of thing in conjuction with creating custom sections etc

  • Simone Chiaretta 134 posts 541 karma points c-trib
    Feb 18, 2016 @ 21:21
    Simone Chiaretta
    0

    Yeah indeed, that's what I realized soon after posting the question

Please Sign in or register to post replies

Write your reply to:

Draft