Пример #1
0
        public override ActionResult LeftNavigation()
        {
            var groupPageXpath = XPathHelper.GetXpath(_documentTypeAliasProvider.GetHomePage(), _documentTypeAliasProvider.GetGroupOverviewPage());
            var groupPage      = _umbracoHelper.TypedContentSingleAtXPath(groupPageXpath);

            var isPageActive = GetIsPageActiveFunc(_umbracoHelper.AssignedContentItem);

            var menuItems = GetMenuItems(groupPage);

            var result = new GroupLeftNavigationMenuViewModel
            {
                Items = menuItems,
                GroupOverviewPageUrl = groupPage.Url,
                IsActive             = isPageActive(groupPage)
            };

            return(PartialView(LeftNavigationPath, result));
        }
Пример #2
0
        public GroupLeftNavigationMenuViewModel GroupNavigation()
        {
            var rootGroupPage = _nodeModelService.AsEnumerable().OfType <UintraGroupsPageModel>().First();

            var groupPageChildren = _nodeModelService.AsEnumerable().Where(x =>
                                                                           x is IGroupNavigationComposition navigation && navigation.GroupNavigation.ShowInMenu &&
                                                                           x.ParentId == rootGroupPage.Id);

            groupPageChildren = groupPageChildren.Where(x =>
            {
                if (x is UintraGroupsCreatePageModel)
                {
                    return(_permissionsService.Check(new PermissionSettingIdentity(PermissionActionEnum.Create,
                                                                                   PermissionResourceTypeEnum.Groups)));
                }

                return(true);
            });

            var menuItems = groupPageChildren.OrderBy(x => ((IGroupNavigationComposition)x).GroupNavigation.SortOrder.Value).Select(x => new GroupLeftNavigationItemViewModel
            {
                Title = ((IGroupNavigationComposition)x).GroupNavigation.NavigationTitle,
                Link  = x.Url.ToLinkModel()
            });

            var result = new GroupLeftNavigationMenuViewModel
            {
                Items         = menuItems,
                GroupPageItem = new GroupLeftNavigationItemViewModel
                {
                    Link  = rootGroupPage.Url.ToLinkModel(),
                    Title = ((IGroupNavigationComposition)rootGroupPage).GroupNavigation.NavigationTitle
                }
            };

            return(result);
        }