I started Umbraco two weeks ago and I try to use sections and trees. After a lot of research I finally made it work but I need some help. Here is my classes:
[Application("tourOp", "tourOp", "Bus.png", 15)] public class tourOpApplication : IApplication { } [PluginController("tourOp")] [Umbraco.Web.Trees.Tree("tourOp", "tourOp_RoomTypes", "Room Types", iconClosed: "Bus.png")] public class tourOp_RoomTypesController : TreeController { protected override Umbraco.Web.Models.Trees.MenuItemCollection GetMenuForNode(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var menu = new MenuItemCollection(); menu.DefaultMenuAlias = ActionNew.Instance.Alias; if (id.Equals("-1")) { menu.Items.Add<ActionNew>("Create"); menu.Items.Add<ActionRefresh>("Refresh"); } else { menu.Items.Add<ActionDelete>("Delete"); } return menu; } protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); if (id.Equals("-1")) { var db = ApplicationContext.Current.DatabaseContext.Database; foreach (RoomTypeViewModel item in db.Query<RoomTypeViewModel>("SELECT * FROM RoomTypes")) { nodes.Add(this.CreateTreeNode(item.RoomTypeID.ToString(), id, queryStrings, item.RoomTypeCode + " (" + item.RoomTypeName + ")", "Hotel.png", true)); } } return nodes; } } public class RoomTypeViewModel { public int RoomTypeID { get; set; } public string RoomTypeCode { get; set; } public string RoomTypeName { get; set; } }
How can I change the code so instead of opening the create.html, edit.html etc to open a server side page like an aspx or an mvc controller so that I will be able to generage dynamically the html.
Some parts of the Umbraco UI are still using webforms. Not everything in 7.0 is upgraded yet. The content and media part are AngularJS, but I think that de settings and developer sections are still webforms (will also become AngularJS in later versions). So it might be a good idea to look at the Umbraco v7 source code to see how the settings and developer section are loaded.
So I have to download the source code of umbraco to find how to develop sectors and trees? Is there any example of creating sectors and trees using AngularJS?
Sections and Trees
I started Umbraco two weeks ago and I try to use sections and trees. After a lot of research I finally made it work but I need some help. Here is my classes:
Umbraco 7 uses AngularJS and plain Html-Files in the back-office to do all the user interaction.
As far as i know there is no possibility to use aspx or mvc pages.
So you have to create a html file for each menu action and also for the view of your tree nodes.
But it's possible to set the name of that file. For the menu actions Umbraoc uses the alias for the menu item.
For your tree nodes you can specify a route path for each node where you can specify which html file should be usesd.
Hello,
Some parts of the Umbraco UI are still using webforms. Not everything in 7.0 is upgraded yet. The content and media part are AngularJS, but I think that de settings and developer sections are still webforms (will also become AngularJS in later versions). So it might be a good idea to look at the Umbraco v7 source code to see how the settings and developer section are loaded.
Jeroen
So I have to download the source code of umbraco to find how to develop sectors and trees? Is there any example of creating sectors and trees using AngularJS?
This documentation might help: http://umbraco.github.io/Belle/#/tutorials/Creating-Editors-Trees
Jeroen
is working on a reply...