Beispiel #1
0
        private PageRoutingHelper CreatePageRoutingHelper(int pageId, int pageVersionId, VisualEditorMode siteViewerMode)
        {
            var allRoutes      = _queryExecutor.GetAll <PageRoute>();
            var allDirectories = _queryExecutor.GetAll <WebDirectoryRoute>();
            var currentRoute   = allRoutes.Single(p => p.PageId == pageId);

            var router = new PageRoutingHelper(allRoutes, allDirectories, currentRoute, siteViewerMode, pageVersionId);

            return(router);
        }
        private PageRoutingHelper CreatePageRoutingHelper(
            PageViewModelBuilderParameters mappingParameters
            )
        {
            var allRoutes      = _queryExecutor.GetAll <PageRoute>();
            var allDirectories = _queryExecutor.GetAll <WebDirectoryRoute>();
            var currentRoute   = allRoutes.Single(p => p.PageId == mappingParameters.PageModel.PageId);

            var router = new PageRoutingHelper(
                allRoutes,
                allDirectories,
                currentRoute,
                mappingParameters.VisualEditorMode,
                mappingParameters.PageModel.PageVersionId
                );

            return(router);
        }
Beispiel #3
0
        private async Task <PageRoutingHelper> CreatePageRoutingHelperAsync(
            PageViewModelBuilderParameters mappingParameters
            )
        {
            var allRoutes = await _queryExecutor.ExecuteAsync(new GetAllPageRoutesQuery());

            var allDirectories = await _queryExecutor.ExecuteAsync(new GetAllPageDirectoryRoutesQuery());

            var currentRoute = allRoutes.Single(p => p.PageId == mappingParameters.PageModel.PageId);

            var router = new PageRoutingHelper(
                allRoutes,
                allDirectories,
                currentRoute,
                mappingParameters.VisualEditorMode,
                mappingParameters.PageModel.PageVersionId
                );

            return(router);
        }
Beispiel #4
0
        private static BreadcrumbsViewModel GetBreadcrumbs(PageRoutingHelper pageRouting)
        {
            if (pageRouting.CurrentPageRoute == null)
            {
                return(null);
            }
            var version = pageRouting.CurrentPageRoute.Versions.GetVersionRouting(pageRouting.VisualEditorMode.ToWorkFlowStatusQuery(), pageRouting.CurrentPageVersionId);
            var crumbs  = new List <BreadcrumbViewModel>
            {
                new BreadcrumbViewModel {
                    Title = version.Title, Href = string.Empty
                }
            };

            var currentDirectory = pageRouting.CurrentPageRoute.WebDirectory;

            if (pageRouting.CurrentPageRoute.IsDirectoryDefaultPage())
            {
                currentDirectory = GetParentDirectory(pageRouting, currentDirectory);
            }

            while (currentDirectory != null)
            {
                var parentDirectory = GetParentDirectory(pageRouting, currentDirectory);
                var title           = parentDirectory.ParentWebDirectoryId.HasValue ? currentDirectory.Name : "Home";
                crumbs.Insert(0, new BreadcrumbViewModel {
                    Title = title, Href = currentDirectory.FullUrlPath
                });

                currentDirectory = parentDirectory;
            }

            return(new BreadcrumbsViewModel {
                Breadcrumbs = crumbs
            });
        }
Beispiel #5
0
 private static WebDirectoryRoute GetParentDirectory(PageRoutingHelper pageRouting, WebDirectoryRoute currentDirectory)
 {
     return(pageRouting.WebDirectoryRoutes.SingleOrDefault(d => d.WebDirectoryId == currentDirectory.ParentWebDirectoryId));
 }