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:
EventHandler that addes the MenuItem
Html View for the dialog
javascript files for the controller and services
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?
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");
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
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:
MenuItem
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?
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: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
Yeah indeed, that's what I realized soon after posting the question
is working on a reply...