public virtual PartialViewResult Render(IPublishedContent content) { AddEntityIdentityForContext( entityId: content.GetKey(), controllerContextType: PagePromotionHelper.IsPromoted(content) ? ContextType.PagePromotion : ControllerContextType); return(PartialView(GridViewPath, content)); }
private List <string> GetPagePromotionContent(IPublishedContent publishedContent) { var content = new List <string>(); var config = PagePromotionHelper.GetConfig(publishedContent); if (config == null) { return(content); } content.Add(config.Title); content.Add(config.Description); return(content); }
private static void UpdatePagePromotionCache(IContent content) { if (!PagePromotionHelper.IsPagePromotion(content)) { return; } var pagePromotionService = DependencyResolver.Current.GetService <IPagePromotionService <Entities.PagePromotion> >(); if (content.Published) { pagePromotionService.Save(new Entities.PagePromotion { Id = content.Key }); } else { pagePromotionService.Delete(content.Key); } }
protected override Entities.PagePromotion MapInternal(IPublishedContent content) { var pagePromotion = content.Map <Entities.PagePromotion>(); var config = PagePromotionHelper.GetConfig(content); if (config.IsNone) { return(null); } config.IfSome(cfg => Mapper.Map(cfg, pagePromotion)); pagePromotion.Type = Type; pagePromotion.CreatorId = _memberService.GetByUserId(pagePromotion.UmbracoCreatorId.Value).Id; var panelValues = _gridHelper.GetValues(content, CommentsPanelAlias, LikesPanelAlias).ToList(); pagePromotion.Commentable = panelValues.Any(panel => panel.alias == CommentsPanelAlias); pagePromotion.Likeable = panelValues.Any(panel => panel.alias == LikesPanelAlias); return(pagePromotion); }
protected override Entities.PagePromotion MapInternal(IPublishedContent content) { var pagePromotion = content.Map <Entities.PagePromotion>(); var config = PagePromotionHelper.GetConfig(content); if (config == null) { return(null); } Mapper.Map(config, pagePromotion); pagePromotion.Type = Type; pagePromotion.CreatorId = _userService.Get(pagePromotion.UmbracoCreatorId.Value).Id; var panelValues = _gridHelper.GetValues(content, GridEditorConstants.CommentsPanelAlias, GridEditorConstants.LikesPanelAlias).ToList(); pagePromotion.Commentable = panelValues.Any(panel => panel.alias == GridEditorConstants.CommentsPanelAlias); pagePromotion.Likeable = panelValues.Any(panel => panel.alias == GridEditorConstants.LikesPanelAlias); return(pagePromotion); }
private static IEnumerable <string> GetPagePromotionContent(IPublishedContent publishedContent) => PagePromotionHelper.GetConfig(publishedContent) .Map(cfg => List(cfg.Title, cfg.Description)) .IfNone(List <string>);