Beispiel #1
0
        public override ActionResult Index(PageListBlock currentBlock)
        {
            var category = Request.RequestContext.GetCustomRouteData <Category>("category");

            //var category = Request.QueryString["cat"];

            if (category == null)
            {
                return(null);
            }
            ;

            var pages = FindPages(currentBlock, category);

            pages = Sort(pages, currentBlock.SortOrder);

            if (currentBlock.Count > 0)
            {
                pages = pages.Take(currentBlock.Count);
            }


            var model = new PageListModel(currentBlock)
            {
                Pages   = pages,
                Heading = category != null ? currentBlock.Heading + " " + category.Name : string.Empty
            };

            ViewData.GetEditHints <PageListModel, PageListBlock>()
            .AddConnection(x => x.Heading, x => x.Heading);

            return(PartialView(model));
        }
Beispiel #2
0
        public ActionResult Index(StandardPageCopy currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            //Using a property multiple times
            PropertyData property = currentPage.Property["TestProp1Description"];

            if (property != null && !property.IsNull)
            {
                var editHints = ViewData.GetEditHints <PageViewModel <StandardPageCopy>, StandardPageCopy>();
                editHints.AddConnection(m => m.CurrentPage.TestProp1, p => p.TestProp1);
                editHints.AddConnection <LinkItemCollection>(m => m.Layout.CustomerZonePages, p => new LinkItemCollection());
            }

            var propertyValueAsString = currentPage["TestProp1Description"] as string;

            if (!string.IsNullOrEmpty(propertyValueAsString))
            {
                //DoSomething();
            }

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StandardPageCopy>, StandardPageCopy>();
                editHints.AddConnection(m => m.CurrentPage.TestProp1, p => p.TestProp1);
                editHints.AddConnection <LinkItemCollection>(m => m.Layout.CustomerZonePages, p => new LinkItemCollection());
            }

            return(View(model));
        }
Beispiel #3
0
        public ActionResult Index(StartPage currentPage, bool isDeleted = false)
        {
            //var masterLanguage = currentPage.MasterLanguage;
            //var repo = ServiceLocator.Current.GetInstance<IContentRepository>();
            //var startPage= repo.Get<PageData>(PageReference.StartPage, masterLanguage);
            //var errorPages = CreatePagesForLanguage(startPage.ContentLink, "sv", repo);
            //var listAllChildren = GetAllChildren(startPage.ContentLink);

            var alloyPlanPage = new ContentReference(6);

            var urlAlloyPlan = UrlResolver.Current.GetUrl(alloyPlanPage);


            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }

            return(View(model));
        }
Beispiel #4
0
        public override ActionResult Index(SidebarNavBlock currentBlock)
        {
            var model = new SidebarNavBlockViewModel(currentBlock);

            // Get the edit hints collection.
            var editingHints = ViewData.GetEditHints <SidebarNavBlockViewModel, SidebarNavBlock>();

            // Add connections between view data properties and content data properties.
            editingHints.AddConnection(viewData => viewData.Heading, contentData => contentData.Heading);
            editingHints.AddConnection(viewData => viewData.Root, contentData => contentData.Root);
            editingHints.AddConnection(viewData => viewData.SortOrder, contentData => contentData.SortOrder);
            editingHints.AddConnection(viewData => viewData.PageTypeFilter, contentData => contentData.PageTypeFilter);
            editingHints.AddConnection(viewData => viewData.CategoryFilter, contentData => contentData.CategoryFilter);
            editingHints.AddConnection(viewData => viewData.Recursive, contentData => contentData.Recursive);

            // Add to the collection of properties which requires full refresh of the block.
            editingHints.AddFullRefreshFor(contentData => contentData.Root);
            editingHints.AddFullRefreshFor(contentData => contentData.SortOrder);
            editingHints.AddFullRefreshFor(contentData => contentData.PageTypeFilter);
            editingHints.AddFullRefreshFor(contentData => contentData.CategoryFilter);
            editingHints.AddFullRefreshFor(contentData => contentData.Recursive);

            // Populate any additional properties in the ViewModel that are not part of the Model.
            var pages = FindPages(currentBlock);

            pages       = Sort(pages, currentBlock.SortOrder);
            model.Pages = pages;

            return(PartialView(model));
        }
Beispiel #5
0
        public override ActionResult Index(ContactBlock currentBlock)
        {
            ContactPage contactPage = null;

            if (!ContentReference.IsNullOrEmpty(currentBlock.ContactPageLink))
            {
                contactPage = _contentLoader.Get <ContactPage>(currentBlock.ContactPageLink);
            }

            var linkUrl = GetLinkUrl(currentBlock);

            var model = new ContactBlockModel
            {
                Heading     = currentBlock.Heading,
                Image       = currentBlock.Image,
                ContactPage = contactPage,
                LinkUrl     = GetLinkUrl(currentBlock),
                LinkText    = currentBlock.LinkText,
                ShowLink    = linkUrl != null
            };

            //As we're using a separate view model with different property names than the content object
            //we connect the view models properties with the content objects so that they can be edited.
            ViewData.GetEditHints <ContactBlockModel, ContactBlock>()
            .AddConnection(x => x.Heading, x => x.Heading)
            .AddConnection(x => x.Image, x => x.Image)
            .AddConnection(x => (object)x.ContactPage, x => (object)x.ContactPageLink)
            .AddConnection(x => x.LinkText, x => x.LinkText);

            return(PartialView(model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }

            var contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>();
            var startPage     = contentLoader.Get <StartPage>(ContentReference.StartPage);
            var url           = UrlResolver.Current.GetUrl(new UrlBuilder(currentPage.LinkURL), EPiServer.Web.ContextMode.Default);
            var baseHref      = UrlResolver.Current.GetUrl(new UrlBuilder(startPage.LinkURL), EPiServer.Web.ContextMode.Default);

            ViewBag.url      = url;
            ViewBag.workid   = currentPage.ContentLink.WorkID;
            ViewBag.baseHref = baseHref;

            return(View(model));
        }
Beispiel #7
0
        public override ActionResult Index(AccordionItemBlock currentBlock)
        {
            var editingHints = ViewData.GetEditHints <IBlockViewModel <AccordionItemBlock>, AccordionItemBlock>();

            editingHints.AddFullRefreshFor(p => p.AccordionContent);

            return(base.Index(currentBlock));
        }
        public ActionResult Index(BookPage currentPage)
        {
            PageViewModel <BookPage> model = new PageViewModel <BookPage>(currentPage);
            var editHints = ViewData.GetEditHints <PageViewModel <BookPage>, BookPage>();

            editHints.AddConnection(m => m.CurrentPage.Category, p => p.Category);
            return(View(model));
        }
        public override ActionResult Index(StaffInfoContainerBlock currentBlock)
        {
            var editingHints = ViewData.GetEditHints <IBlockViewModel <StaffInfoContainerBlock>, StaffInfoContainerBlock>();

            editingHints.AddFullRefreshFor(p => p.StaffInfoContentArea);

            return(base.Index(currentBlock));
        }
        public override ActionResult Index(EmailSignupBlock currentBlock)
        {
            var editingHints = ViewData.GetEditHints <IBlockViewModel <EmailSignupBlock>, EmailSignupBlock>();

            editingHints.AddFullRefreshFor(p => p.PlaceholderText);

            return(base.Index(currentBlock));
        }
Beispiel #11
0
        public ViewResult Index(SitePageData currentPage)
        {
            // Ensure there is a full referesh when the PageIsNavigationRoot is checked on the breadcrumb
            var editHints = ViewData.GetEditHints <PageViewModel <SitePageData>, SitePageData>();

            editHints.AddFullRefreshFor(m => m.PageIsNavigationRoot);

            var model = CreateModel(currentPage);

            return(View(string.Format("~/Views/{0}/Index.cshtml", currentPage.GetOriginalType().Name), model));
        }
Beispiel #12
0
        /// <summary>
        /// Index action of this page
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <returns></returns>
        public ActionResult Index(StartPage currentPage)
        {
            var editHints = ViewData.GetEditHints <StartPage, StartPage>();

            editHints.AddConnection(v => PageLayout.MetaHeaderNavigation, c => c.MetaHeaderNavigation);
            editHints.AddConnection(v => PageLayout.MetaFooterNavigation, c => c.MetaFooterNavigation);

            var model = currentPage;

            return(View(model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink))
            {
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logo, p => p.SiteLogo);
                editHints.AddConnection(m => m.Layout.Copyright, p => p.Copyright);
            }
            return(View(model));
        }
        public ActionResult Index(CategoryPage currentPage)
        {
            var model = currentPage; //PageViewModel.Create(currentPage);

            //Connect the view models logotype property to the start page's to make it editable
            var editHints = ViewData.GetEditHints <CategoryPage, CategoryPage>();

            editHints.AddConnection(m => m.Category, p => p.Category);
            editHints.AddConnection(m => m.StartPublish, p => p.StartPublish);

            return(View(model));
        }
Beispiel #15
0
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                //editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
            }

            return(View(model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }


            // Demo av cache

            ObjectCache cache = MemoryCache.Default;


            // Kolla om värdet fanns sparat - hoppa över det som tar lång tid i så fall
            var value = cache.Get("TaskThatTakesLooongTimeToDo") as string;

            if (value == null)
            {
                // Hämta värde tar lång tid
                value = TaskThatTakesLooongTimeToDo();

                // Spara för framtiden

                var policy = new CacheItemPolicy
                {
                    AbsoluteExpiration = DateTimeOffset.UtcNow.AddSeconds(15)
                                         //SlidingExpiration = new TimeSpan(0, 0, 30)
                };
                cache.Set("TaskThatTakesLooongTimeToDo", value, policy);
            }
            else
            {
                logger.Debug("TaskThatTakesLooongTimeToDo found in cache.");
            }



            model.LongTimeWork = value;



            return(View(model));
        }
        public ActionResult Full(BookPage currentPage)
        {
            var model = new BookItemModel(currentPage)
            {
                Category = currentPage.Category,
                Tags     = GetTags(currentPage)
            };

            var editHints = ViewData.GetEditHints <BookItemModel, BookPage>();

            editHints.AddConnection(m => m.Category, p => p.Category);
            editHints.AddFullRefreshFor(p => p.Category);
            editHints.AddFullRefreshFor(p => p.StartPublish);

            return(PartialView("Full", model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            // Check if it is the StartPage or just a page of the StartPage type.
            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink))
            {
                // Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <StartPage, StartPage>();
                editHints.AddConnection(m => PageLayout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => PageLayout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => PageLayout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => PageLayout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => PageLayout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }

            return(View(currentPage));
        }
        public ActionResult Full(CategoryPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new CategoryPageModel(currentPage)
            {
                PreviewText = GetPreviewText(currentPage),
                //MainBody = currentPage.MainBody,
                StartPublish = currentPage.StartPublish
            };

            var editHints = ViewData.GetEditHints <CategoryPageModel, CategoryPage>();

            editHints.AddFullRefreshFor(p => p.StartPublish);

            return(PartialView("Full", model));
        }
Beispiel #20
0
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (ContentReference.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }

            return(View(model));
        }
Beispiel #21
0
        public ActionResult Index(LocationItemPage currentPage)
        {
            var model = new LocationItemViewModel(currentPage);

            if (!ContentReference.IsNullOrEmpty(currentPage.Image))
            {
                model.Image = _contentRepository.Get <ImageData>(currentPage.Image);
            }

            model.LocationNavigation.ContinentLocations = SearchClient.Instance
                                                          .Search <LocationItemPage>()
                                                          .Filter(x => x.Continent.Match(currentPage.Continent))
                                                          .PublishedInCurrentLanguage()
                                                          .OrderBy(x => x.PageName)
                                                          .FilterForVisitor()
                                                          .Take(100)
                                                          .StaticallyCacheFor(new System.TimeSpan(0, 10, 0))
                                                          .GetContentResult();

            model.LocationNavigation.CloseBy = SearchClient.Instance
                                               .Search <LocationItemPage>()
                                               .Filter(x => x.Continent.Match(currentPage.Continent)
                                                       & !x.PageLink.Match(currentPage.PageLink))
                                               .PublishedInCurrentLanguage()
                                               .FilterForVisitor()
                                               .OrderBy(x => x.Coordinates)
                                               .DistanceFrom(currentPage.Coordinates)
                                               .Take(5)
                                               .StaticallyCacheFor(new System.TimeSpan(0, 10, 0))
                                               .GetContentResult();

            if (currentPage.Categories != null)
            {
                model.Tags = currentPage.Categories.Select(x => _contentRepository.Get <StandardCategory>(x));
            }

            var editingHints = ViewData.GetEditHints <LocationItemViewModel, LocationItemPage>();

            editingHints.AddFullRefreshFor(p => p.Image);
            editingHints.AddFullRefreshFor(p => p.Categories);

            return(View(model));
        }
        public override ActionResult Index(WishBookPageListBlock currentBlock)
        {
            var contentRepository = ServiceLocator.Current.GetInstance <IContentLoader>();
            var model             = new WishBookPageListModel(currentBlock);

            if (currentBlock.Root != null)
            {
                model.Pages = contentRepository.GetChildren <WishBookPage>(currentBlock.Root);
            }
            else
            {
                model.Pages = null;
            }

            ViewData.GetEditHints <WishBookPageListModel, WishBookPageListBlock>()
            .AddConnection(x => x.Heading, x => x.Heading);

            return(PartialView(model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }
            //Response.Cache.SetCacheability(System.Web.HttpCacheability.Public);
            //Response.Cache.SetExpires(System.DateTime.Now.AddHours(1));
            //Response.Cache.SetSlidingExpiration(true);
            return(View(model));
        }
        public ActionResult Index(StartPage currentPage)
        {
            var model = PageViewModel.Create(currentPage);

            if (SiteDefinition.Current.StartPage.CompareToIgnoreWorkID(currentPage.ContentLink)) // Check if it is the StartPage or just a page of the StartPage type.
            {
                //Connect the view models logotype property to the start page's to make it editable
                var editHints = ViewData.GetEditHints <PageViewModel <StartPage>, StartPage>();
                editHints.AddConnection(m => m.Layout.Logotype, p => p.SiteLogotype);
                editHints.AddConnection(m => m.Layout.ProductPages, p => p.ProductPageLinks);
                editHints.AddConnection(m => m.Layout.CompanyInformationPages, p => p.CompanyInformationPageLinks);
                editHints.AddConnection(m => m.Layout.NewsPages, p => p.NewsPageLinks);
                editHints.AddConnection(m => m.Layout.CustomerZonePages, p => p.CustomerZonePageLinks);
            }

            var repo      = ServiceLocator.Current.GetInstance <ITemplateRepository>();
            var templates = repo.List(typeof(GenericBlock));

            return(View(model));
        }
Beispiel #25
0
        public ViewResult Index(PageData currentPage)
        {
            var virtualPath = String.Format("~/Views/{0}/Index.cshtml", currentPage.GetOriginalType().Name);

            if (System.IO.File.Exists(Request.MapPath(virtualPath)) == false)
            {
                virtualPath = "Index";
            }

            var model     = CreatePageViewModel(currentPage);
            var editHints = ViewData.GetEditHints <Chrome, HomePage>();

            editHints.AddConnection(c => c.GlobalFooterContent, p => p.GlobalFooterContent);
            // Since we're handling the logo property a bit different (url comes from view model)
            // we need to refresh the page when it changes.
            // editHints.AddFullRefreshFor(c => c.LogoImage);


            return(View(virtualPath, model));
        }
Beispiel #26
0
        public override ActionResult Index(PageListBlock currentBlock)
        {
            var pages = FindPages(currentBlock);

            pages = Sort(pages, currentBlock.SortOrder);

            if (currentBlock.Count > 0)
            {
                pages = pages.Take(currentBlock.Count);
            }

            var model = new PageListModel(currentBlock)
            {
                Pages = pages
            };

            ViewData.GetEditHints <PageListModel, PageListBlock>()
            .AddConnection(x => x.Heading, x => x.Heading);

            return(PartialView(model));
        }
        public ActionResult Full(BlogItemPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new BlogItemPageModel(currentPage)
            {
                Category     = currentPage.Category,
                Tags         = GetTags(currentPage),
                PreviewText  = GetPreviewText(currentPage),
                MainBody     = currentPage.MainBody,
                StartPublish = currentPage.StartPublish.Value
            };

            var editHints = ViewData.GetEditHints <BlogItemPageModel, BlogItemPage>();

            editHints.AddConnection(m => m.Category, p => p.Category);
            editHints.AddFullRefreshFor(p => p.Category);
            editHints.AddFullRefreshFor(p => p.StartPublish);

            return(PartialView("Full", model));
        }
Beispiel #28
0
        public IActionResult Index(Models.BlogItemPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new BlogItemPageViewModel(currentPage)
            {
                Category     = currentPage.Category,
                Tags         = /*GetTags(currentPage)*/ new List <TagItem>(),
                PreviewText  = GetPreviewText(currentPage),
                MainBody     = currentPage.MainBody,
                StartPublish = currentPage.StartPublish ?? DateTime.UtcNow,
                BreadCrumbs  = GetBreadCrumb(currentPage)
            };

            var editHints = ViewData.GetEditHints <ContentViewModel <Models.BlogItemPage>, Models.BlogItemPage>();

            editHints.AddConnection(m => m.CurrentContent.Category, p => p.Category);
            editHints.AddConnection(m => m.CurrentContent.StartPublish, p => p.StartPublish);

            return(View(model));
        }
Beispiel #29
0
        public override ActionResult Index(PageListBlock currentBlock)
        {
            var pages = FindPages(currentBlock);

            pages = Sort(pages, currentBlock.SortOrder);

            if (currentBlock.Count > 0)
            {
                pages = pages.Take(currentBlock.Count);
            }

            var model = new PageListBlockViewModel(currentBlock)
            {
                Pages = pages.Select(x => new PageListPreviewViewModel(x, currentBlock))
            };

            ViewData.GetEditHints <PageListBlockViewModel, PageListBlock>()
            .AddConnection(x => x.Heading, x => x.Heading);

            return(PartialView("~/Features/Blocks/PageListBlock/PageListBlock.cshtml", model));
        }
        public override IViewComponentResult Invoke(PageListBlock currentBlock)
        {
            var pages = FindPages(currentBlock);

            pages = Sort(pages, currentBlock.SortOrder);

            if (currentBlock.Count > 0)
            {
                pages = pages.Take(currentBlock.Count);
            }

            var model = new PageListModel(currentBlock)
            {
                Pages = pages.Cast <PageData>()
            };

            ViewData.GetEditHints <PageListModel, PageListBlock>()
            .AddConnection(x => x.Heading, x => x.Heading);

            return(View(model));
        }