public ActionResult Index(string token)
        {
            var externalReviewLink = _externalReviewLinksRepository.GetContentByToken(token);

            if (!externalReviewLink.IsEditableLink())
            {
                return(new HttpNotFoundResult("Content not found"));
            }

            var content = _contentLoader.Get <IContent>(externalReviewLink.ContentLink);

            const string url          = "Views/PagePreview/Index.cshtml";
            var          startPageUrl = _urlResolver.GetUrl(ContentReference.StartPage);

            if (ModuleResourceResolver.Instance.TryResolvePath(typeof(PageEditController).Assembly, url,
                                                               out var resolvedPath))
            {
                var serializer       = _serializerFactory.GetSerializer(KnownContentTypes.Json);
                var pagePreviewModel = new ContentPreviewModel
                {
                    Token = token,
                    Name  = content.Name,
                    EditableContentUrlSegment =
                        $"{startPageUrl}{_externalReviewOptions.ContentIframeEditUrlSegment}/{token}",
                    ReviewJsScriptPath = GetJsScriptPath(),
                    ResetCssPath       = GetResetCssPath(),
                    ReviewPins         = serializer.Serialize(_approvalReviewsRepository.Load(externalReviewLink.ContentLink)),
                    Metadata           = serializer.Serialize(_propertyResolver.Resolve(content as ContentData))
                };
                return(View(resolvedPath, pagePreviewModel));
            }

            return(new HttpNotFoundResult("Content not found"));
        }
Пример #2
0
        public ActionResult Get(ContentReference id)
        {
            var errorResult = ValidateContent(id);

            if (errorResult != null)
            {
                return(errorResult);
            }

            return(Rest(_approvalReviewsRepository.Load(id)));
        }