Пример #1
0
        public virtual ActionResult App(string appAlias)
        {
            //we need to ensure the sprite files for the tree/app icons are added to CDF
            foreach (var path in BackOfficeRequestContext.DocumentTypeIconResolver.Sprites
                     .Select(sprites =>
                             BackOfficeRequestContext.Application.Settings.UmbracoFolders.DocTypeIconFolder + "/" + sprites.Value.Name))
            {
                HttpContext.GetLoader().RegisterDependency(path, ClientDependencyType.Css);
            }
            foreach (var path in BackOfficeRequestContext.ApplicationIconResolver.Sprites
                     .Select(sprites =>
                             BackOfficeRequestContext.Application.Settings.UmbracoFolders.ApplicationIconFolder + "/" + sprites.Value.Name))
            {
                HttpContext.GetLoader().RegisterDependency(path, ClientDependencyType.Css);
            }

            //create all menu item instances one time for rendering

            //Register all client dependencies for each menu item and tree that is found
            var dependencies = new List <IClientDependencyFile>();

            foreach (var attr in _menuItems
                     .Select(m => m.Metadata.ComponentType.GetCustomAttributes(typeof(ClientDependencyAttribute), true)
                             .OfType <ClientDependencyAttribute>()
                             .Where(x => !string.IsNullOrEmpty(x.FilePath))))
            {
                dependencies.AddRange(attr);
            }
            foreach (var attr in _trees
                     .Select(t => t.Metadata.ComponentType.GetCustomAttributes(typeof(ClientDependencyAttribute), true)
                             .OfType <ClientDependencyAttribute>()
                             .Where(x => !string.IsNullOrEmpty(x.FilePath))))
            {
                dependencies.AddRange(attr);
            }


            ControllerContext.GetLoader().RegisterClientDependencies(dependencies, new List <IClientDependencyPath>());

            //create the model to return
            var model = new BackOfficeDefaultModel
            {
                //Applications = apps,
                TreeModel = new TreeRenderModel(Url.GetTreeUrl(appAlias))
                {
                    ManuallyInitialize = true
                },
                //DefaultDashboardEditor = editor,
                CurrentApplicationAlias = appAlias,
                MenuItems = _menuItems.Select(x => x.Value)
            };

            return(View("Index", model));
        }
Пример #2
0
        public virtual ActionResult App(string appAlias)
        {
            
            //create the model to return
            var model = new BackOfficeDefaultModel
                            {
                                //Applications = apps,
                                TreeModel = new TreeRenderModel(Url.GetTreeUrl(appAlias)) { ManuallyInitialize = true },
                                //DefaultDashboardEditor = editor,
                                CurrentApplicationAlias = appAlias,
                                MenuItems = _menuItems.Select(x => x.Value)
                            };

            return View("Index", model);
        }
Пример #3
0
        public virtual ActionResult App(string appAlias)
        {
            //we need to ensure the sprite files for the tree/app icons are added to CDF
            foreach (var path in BackOfficeRequestContext.DocumentTypeIconResolver.Sprites
                .Select(sprites =>
                    BackOfficeRequestContext.Application.Settings.UmbracoFolders.DocTypeIconFolder + "/" + sprites.Value.Name))
            {
                HttpContext.GetLoader().RegisterDependency(path, ClientDependencyType.Css);
            }
            foreach (var path in BackOfficeRequestContext.ApplicationIconResolver.Sprites
                .Select(sprites =>
                    BackOfficeRequestContext.Application.Settings.UmbracoFolders.ApplicationIconFolder + "/" + sprites.Value.Name))
            {
                HttpContext.GetLoader().RegisterDependency(path, ClientDependencyType.Css);
            }

            //create all menu item instances one time for rendering

            //Register all client dependencies for each menu item and tree that is found
            var dependencies = new List<IClientDependencyFile>();

            foreach (var attr in _menuItems
                    .Select(m => m.Metadata.ComponentType.GetCustomAttributes(typeof(ClientDependencyAttribute), true)
                    .OfType<ClientDependencyAttribute>()
                    .Where(x => !string.IsNullOrEmpty(x.FilePath))))
            {
                dependencies.AddRange(attr);
            }
            foreach (var attr in _trees
                .Select(t => t.Metadata.ComponentType.GetCustomAttributes(typeof(ClientDependencyAttribute), true)
                .OfType<ClientDependencyAttribute>()
                .Where(x => !string.IsNullOrEmpty(x.FilePath))))
            {
                dependencies.AddRange(attr);
            }


            ControllerContext.GetLoader().RegisterClientDependencies(dependencies, new List<IClientDependencyPath>());

            //create the model to return
            var model = new BackOfficeDefaultModel
                            {
                                //Applications = apps,
                                TreeModel = new TreeRenderModel(Url.GetTreeUrl(appAlias)) { ManuallyInitialize = true },
                                //DefaultDashboardEditor = editor,
                                CurrentApplicationAlias = appAlias,
                                MenuItems = _menuItems.Select(x => x.Value)
                            };

            return View("Index", model);
        }