Copied to clipboard

Flag this post as spam?

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


  • Aristotelis Pitaridis 84 posts 402 karma points
    Jan 13, 2014 @ 21:41
    Aristotelis Pitaridis
    0

    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:

     

    [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.
    Thanks in advance.
  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jan 17, 2014 @ 15:33
    David Brendel
    0

    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.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 19, 2014 @ 11:15
    Jeroen Breuer
    0

    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

  • Aristotelis Pitaridis 84 posts 402 karma points
    Jan 19, 2014 @ 13:31
    Aristotelis Pitaridis
    0

    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?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Jan 19, 2014 @ 13:48
    Jeroen Breuer
    0

    This documentation might help: http://umbraco.github.io/Belle/#/tutorials/Creating-Editors-Trees

    Jeroen

     

Please Sign in or register to post replies

Write your reply to:

Draft