예제 #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);
        }
예제 #2
0
        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);
        }
예제 #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);
        }
예제 #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
            });
        }
예제 #5
0
 private static WebDirectoryRoute GetParentDirectory(PageRoutingHelper pageRouting, WebDirectoryRoute currentDirectory)
 {
     return(pageRouting.WebDirectoryRoutes.SingleOrDefault(d => d.WebDirectoryId == currentDirectory.ParentWebDirectoryId));
 }