public ActionResult TopNavigation()
        {
            var item = RenderingContext.Current.Rendering.Item;

            TopNavigationModel model = new TopNavigationModel();

            model.SearchPlaceholder = item.Fields["Search Placeholder"].Value;
            model.CtaText           = item.Fields["CTA Text"].Value;

            return(View("TopNavigation", model));
        }
        public virtual TopNavigationModel GetMobileNavigation()
        {
            var model = new TopNavigationModel
            {
                CurrentMember = _intranetMemberService.GetCurrentMember(),
                Items         = new List <TopNavigationItem>
                {
                    new TopNavigationItem
                    {
                        Name = _intranetLocalizationService.Translate("TopNavigation.Logout.lbl"),
                        Type = TopNavigationItemTypes.Logout,
                        Url  = "/api/auth/logout".ToLinkModel()
                    }
                }
            };

            return(model);
        }
        public virtual TopNavigationModel GetTopNavigationModel()
        {
            var menuItems     = new List <TopNavigationItem>();
            var currentMember = _intranetMemberService.GetCurrentMember();

            if (currentMember.RelatedUser != null)
            {
                menuItems.Add(new TopNavigationItem
                {
                    Name = _intranetLocalizationService.Translate("TopNavigation.LoginToUmbraco.lbl"),
                    Type = TopNavigationItemTypes.LoginToUmbraco,
                    Url  = "/api/auth/login/umbraco".ToLinkModel()
                });
            }
            menuItems.Add(new TopNavigationItem
            {
                Name = _intranetLocalizationService.Translate("TopNavigation.EditProfile.lbl"),
                Type = TopNavigationItemTypes.EditProfile,
                Url  = _intranetUserContentProvider.GetEditPage().Url.ToLinkModel(),
            });

            menuItems.Add(new TopNavigationItem
            {
                Name = $"{_intranetLocalizationService.Translate("TopNavigation.UintraDocumentationLink.lnk")} v{_uintraInformationService.Version}",
                Type = TopNavigationItemTypes.UintraHelp,
                Url  = _uintraInformationService.DocumentationLink.ToString().ToLinkModel()
            });

            menuItems.Add(new TopNavigationItem
            {
                Name = _intranetLocalizationService.Translate("TopNavigation.Logout.lbl"),
                Type = TopNavigationItemTypes.Logout,
                Url  = "/api/auth/logout".ToLinkModel()
            });

            var model = new TopNavigationModel
            {
                CurrentMember = _intranetMemberService.GetCurrentMember(),
                Items         = menuItems
            };

            return(model);
        }
Exemplo n.º 4
0
        public ActionResult GetTopNav(SitePageBase page)
        {
            //var listServiceStartPages = _groContentDataService.GetChildrenByVisitor<ServiceStartPage>(ContentReference.StartPage, true);
            var startPage = _contentRepository.Get <StartPage>(ContentReference.StartPage);

            var listServiceStartPages = _groContentDataService.GetChildrenForVisitor <ServiceStartPage>(startPage,
                                                                                                        HttpContext);
            var model = new TopNavigationModel();

            var serviceStartPages = listServiceStartPages as ServiceStartPage[] ?? listServiceStartPages.ToArray();

            if (serviceStartPages.Any())
            {
                model.ListServiceStartPageItems.AddRange(serviceStartPages.Select(item => new NavigationItemModel
                {
                    ContentLink = item.ContentLink,
                    Text        = item.Name,
                    CssClass    = GetNavCssClassForService(item)
                }));
            }

            // get service name
            var topLevelServiceStartPage = page as ServiceStartPage ?? _groContentDataService.FindAncestor <ServiceStartPage>(page);
            var startPageRef             = topLevelServiceStartPage?.ContentLink ?? ContentReference.EmptyReference;
            var startpageText            = topLevelServiceStartPage?.Name ?? string.Empty;

            if (string.IsNullOrEmpty(startpageText))
            {
                var topLevelStartPage = page as StartPage ?? _groContentDataService.FindAncestor <StartPage>(page);
                if (topLevelStartPage != null && !ContentReference.IsNullOrEmpty(topLevelStartPage.SettingsPage))
                {
                    var settingPage = _contentRepository.Get <PageData>(topLevelStartPage.SettingsPage);
                    startpageText = (settingPage as SettingsPage)?.SelectServiceText ?? string.Empty;
                    startPageRef  = topLevelStartPage.ContentLink;
                }
            }
            model.StartPageText      = startpageText;
            model.StartpageReference = startPageRef;

            return(PartialView("Navigations/_TopNavigation", model));
        }