Пример #1
0
        public ViewResult ViewPageContent(NeptunePageTypeEnum neptunePageTypeEnum)
        {
            var neptunePageType = NeptunePageType.ToType(neptunePageTypeEnum);
            var viewData        = new DisplayPageContentViewData(CurrentPerson, neptunePageType);

            return(RazorView <DisplayPageContent, DisplayPageContentViewData>(viewData));
        }
Пример #2
0
        public ViewResult ViewPageContent(FirmaPageTypeEnum firmaPageTypeEnum)
        {
            var firmaPage     = firmaPageTypeEnum.GetFirmaPage();
            var hasPermission = new FirmaPageManageFeature().HasPermission(CurrentFirmaSession, firmaPage).HasPermission;
            var viewData      = new DisplayPageContentViewData(CurrentFirmaSession, firmaPage, hasPermission);

            return(RazorView <DisplayPageContent, DisplayPageContentViewData>(viewData));
        }
        public ActionResult About(string vanityUrl)
        {
            var customPage = MultiTenantHelpers.GetAllCustomPages()
                             .SingleOrDefault(x => x.CustomPageVanityUrl == vanityUrl);

            new CustomPageViewFeature().DemandPermission(CurrentPerson, customPage);
            var hasPermission = new CustomPageManageFeature().HasPermission(CurrentPerson, customPage).HasPermission;
            var viewData      = new DisplayPageContentViewData(CurrentPerson, customPage, hasPermission);

            return(RazorView <DisplayPageContent, DisplayPageContentViewData>(viewData));
        }
Пример #4
0
        public ActionResult ViewCustomPage(string route, string vanityUrl)
        {
            var customPage = MultiTenantHelpers.GetCustomPages()
                             .SingleOrDefault(x => string.Equals(x.CustomPageVanityUrl, vanityUrl, StringComparison.OrdinalIgnoreCase));

            if (vanityUrl.IsEmpty() || customPage == null)
            {
                // Search engines sometimes have stale routes; we re-map for them.
                // (This is really fairly coddled, but it could benefit humans too, theoretically.)
                string remappedVanityUrl = null;
                switch (vanityUrl)
                {
                case "MeetingsAndNotes":
                    remappedVanityUrl = "MeetingNotes";
                    break;

                case "AboutClackamasPartnership":
                    remappedVanityUrl = "About";
                    break;
                }

                // If we found a remapping, redirect permanently to it
                if (remappedVanityUrl != null)
                {
                    return(RedirectToAction(new SitkaRoute <CustomPageController>(x => x.ViewCustomPage(route, remappedVanityUrl))));
                }

                // Otherwise, we just redirect to the site's main page, and put up a warning in case this was actually a human doing the navigation.
                SetWarningForDisplay($"Could not find vanity URL /{route}: \"{vanityUrl}\"");
                return(RedirectToAction(new SitkaRoute <HomeController>(x => x.Index())));

                // Since we either return the requested vanity URL, OR redirect to SOMETHING, search engines should
                // stop bashing their heads eventually here.
            }
            new CustomPageViewFeature().DemandPermission(CurrentFirmaSession, customPage);
            var hasPermission = new CustomPageManageFeature().HasPermission(CurrentFirmaSession, customPage).HasPermission;
            var viewData      = new DisplayPageContentViewData(CurrentFirmaSession, customPage, hasPermission);

            return(RazorView <DisplayPageContent, DisplayPageContentViewData>(viewData));
        }