コード例 #1
0
        public async Task <ProfileEntity> GetProfile(string slug)
        {
            var response = await _repository.Get <ProfileResponse>(slug);

            if (response.StatusCode == 200)
            {
                var profile       = response.Content as ProfileResponse;
                var triviaSection = _triviaFactory.Build(profile.TriviaSection);

                var processedBody = _parser.ParseAll(profile.Body, profile.Title, false);
                processedBody = _markdownWrapper.ConvertToHtml(processedBody);
                processedBody = _alertsInlineTagParser.Parse(processedBody, profile.Alerts);
                processedBody = _inlineQuotesTagParser.Parse(processedBody, profile.InlineQuotes);

                return(new ProfileEntity
                {
                    Title = profile.Title,
                    Slug = profile.Slug,
                    Teaser = profile.Teaser,
                    Quote = profile.Quote,
                    Image = profile.Image,
                    Body = processedBody,
                    Breadcrumbs = profile.Breadcrumbs,
                    Alerts = profile.Alerts,
                    TriviaSubheading = profile.TriviaSubheading,
                    TriviaSection = triviaSection,
                    Subtitle = profile.Subtitle,
                    InlineQuotes = profile.InlineQuotes,
                    EventsBanner = profile.EventsBanner
                });
            }

            return(null);
        }
コード例 #2
0
        public virtual ProcessedStartPage Build(StartPage startPage)
        {
            var upperBody = _tagParserContainer.ParseAll(startPage.UpperBody ?? "", startPage.Title);

            upperBody = _markdownWrapper.ConvertToHtml(startPage.UpperBody ?? "");

            upperBody = _alertsInlineTagParser.Parse(upperBody, startPage.AlertsInline);



            return(new ProcessedStartPage(
                       startPage.Slug,
                       startPage.Title,
                       startPage.Teaser,
                       startPage.Summary,
                       upperBody,
                       startPage.FormLinkLabel,
                       startPage.FormLink,
                       startPage.LowerBody,
                       startPage.Breadcrumbs,
                       startPage.BackgroundImage,
                       startPage.Icon,
                       startPage.Alerts
                       ));
        }
コード例 #3
0
        public ProcessedSection Build(Section section, string articleTitle = null)
        {
            var parsedBody = _markdownWrapper.ConvertToHtml(section.Body);

            parsedBody = _profileTagParser.Parse(parsedBody, section.Profiles);
            parsedBody = _documentTagParser.Parse(parsedBody, section.Documents);
            parsedBody = _alertsInlineTagParser.Parse(parsedBody, section.AlertsInline);
            parsedBody = _searchTagParser.Parse(parsedBody, new List <S3BucketSearch> {
                section.S3Bucket
            });

            if (section.Body.Contains("PrivacyNotice:"))
            {
                section.PrivacyNotices = GetPrivacyNotices().Result;
                parsedBody             = _privacyNoticeTagParser.Parse(parsedBody, section.PrivacyNotices);
            }

            parsedBody = _tagParserContainer.ParseAll(parsedBody, articleTitle);

            return(new ProcessedSection(
                       section.Title,
                       section.Slug,
                       section.MetaDescription,
                       parsedBody,
                       section.Profiles,
                       section.Documents,
                       section.AlertsInline
                       ));
        }
コード例 #4
0
        public virtual ProcessedArticle Build(Article article)
        {
            var processedSections = new List <ProcessedSection>();

            foreach (var section in article.Sections)
            {
                section.S3Bucket = article.S3Bucket;
                processedSections.Add(_sectionFactory.Build(section, article.Title));
            }

            var body = _markdownWrapper.ConvertToHtml(article.Body ?? "");

            body = _profileTagParser.Parse(body, article.Profiles);
            body = _documentTagParser.Parse(body, article.Documents);
            body = _alertsInlineTagParser.Parse(body, article.AlertsInline);
            body = _searchTagParser.Parse(body, new List <S3BucketSearch> {
                article.S3Bucket
            });
            if (body.Contains("PrivacyNotice:"))
            {
                article.PrivacyNotices = GetPrivacyNotices().Result;
                body = _privacyNoticeTagParser.Parse(body, article.PrivacyNotices);
            }

            body = _tagParserContainer.ParseAll(body, article.Title);

            return(new ProcessedArticle(article.Title, article.Slug, body, article.Teaser, article.MetaDescription,
                                        processedSections, article.Icon, article.BackgroundImage, article.Image, article.Breadcrumbs, article.Alerts, article.ParentTopic, article.AlertsInline, article.S3Bucket, article.UpdatedAt, article.HideLastUpdated));
        }
コード例 #5
0
        public virtual ProcessedNews Build(News news)
        {
            var body = _simpleTagParserContainer.ParseAll(news.Body, news.Title);

            body = _markdownWrapper.ConvertToHtml(body ?? "");
            body = _documentTagParser.Parse(body, news.Documents);

            return(new ProcessedNews(news.Title, news.Slug, news.Teaser, news.Purpose, news.Image, news.ThumbnailImage, body, news.Breadcrumbs, news.SunriseDate, news.SunsetDate, news.Alerts, news.Tags));
        }
コード例 #6
0
        public ProcessedContactUsCategory Build(ContactUsCategory contactUsCategory)
        {
            var parsedBodyTextLeft = _markdownWrapper.ConvertToHtml(contactUsCategory.BodyTextLeft);

            //parsedBodyTextLeft = _documentTagParser.Parse(parsedBodyTextLeft);
            parsedBodyTextLeft = _tagParserContainer.ParseAll(parsedBodyTextLeft);

            var parsedBodyTextRight = _markdownWrapper.ConvertToHtml(contactUsCategory.BodyTextRight);

            //parsedBodyTextRight = _documentTagParser.Parse(parsedBodyTextRight, contactUsCategory.Documents);
            parsedBodyTextRight = _tagParserContainer.ParseAll(parsedBodyTextRight);

            return(new ProcessedContactUsCategory(
                       contactUsCategory.Title,
                       parsedBodyTextLeft,
                       parsedBodyTextRight,
                       contactUsCategory.Icon
                       ));
        }
コード例 #7
0
        public virtual ProcessedGroup Build(Group group)
        {
            var htmlBody      = _markdownWrapper.ConvertToHtml(group.Description);
            var processedBody = _parser.ParseAll(htmlBody, group.Name);

            var additionalInformation       = _markdownWrapper.ConvertToHtml(group.AdditionalInformation);
            var parsedAdditionalInformation = _parser.ParseAll(additionalInformation, group.Name);

            processedBody = Regex.Replace(processedBody, "<script", "<scri-pt", RegexOptions.IgnoreCase);
            processedBody = Regex.Replace(processedBody, "javascript", "javascri-pt", RegexOptions.IgnoreCase);

            var volunteering = new Volunteering()
            {
                Email              = group.Email,
                VolunteeringText   = group.VolunteeringText,
                VolunteeringNeeded = group.Volunteering,
                Url  = $"groups/{group.Slug}",
                Type = "group"
            };

            var donations = new Donations()
            {
                GetDonations  = group.Donations,
                Url           = $"groups/{group.Slug}",
                Email         = group.Email,
                DonationsText = group.DonationsText,
                DonationsUrl  = group.DonationsUrl
            };
            var mapDetails = new MapDetails()
            {
                MapPosition             = group.MapPosition,
                AccessibleTransportLink = group.AccessibleTransportLink
            };

            return(new ProcessedGroup(group.Name, group.Slug, group.MetaDescription, group.PhoneNumber, group.Email, group.Website, group.Twitter,
                                      group.Facebook, group.Address, processedBody, group.ImageUrl, group.ThumbnailImageUrl, group.CategoriesReference, group.SubCategories,
                                      group.Breadcrumbs, group.Events, group.GroupAdministrators, group.DateHiddenFrom, group.DateHiddenTo,
                                      group.Cost, group.CostText, group.AbilityLevel, group.Favourite, volunteering, group.Organisation,
                                      group.LinkedGroups, donations, mapDetails, parsedAdditionalInformation, group.AdditionalDocuments, group.DonationsText, group.DonationsUrl,
                                      group.DateLastModified, group.GroupBranding, group.Alerts));
        }
コード例 #8
0
        public virtual ProcessedGroupHomepage Build(GroupHomepage groupHomepage)
        {
            var body     = _tagParserContainer.ParseAll(groupHomepage.Body);
            var bodyHtml = _markdownWrapper.ConvertToHtml(body ?? string.Empty);

            var secondaryBody     = _tagParserContainer.ParseAll(groupHomepage.SecondaryBody);
            var secondaryBodyHtml = _markdownWrapper.ConvertToHtml(secondaryBody ?? string.Empty);

            return(new ProcessedGroupHomepage(
                       groupHomepage.Title,
                       groupHomepage.MetaDescription,
                       groupHomepage.BackgroundImage,
                       groupHomepage.FeaturedGroupsHeading,
                       groupHomepage.FeaturedGroups,
                       groupHomepage.FeaturedGroupsCategory,
                       groupHomepage.FeaturedGroupsSubCategory,
                       groupHomepage.Alerts,
                       groupHomepage.BodyHeading,
                       bodyHtml,
                       groupHomepage.SecondaryBodyHeading,
                       secondaryBodyHtml,
                       groupHomepage.EventBanner
                       ));
        }
コード例 #9
0
        public virtual ProcessedEvents Build(Event eventItem)
        {
            var mapDetails = new MapDetails()
            {
                MapPosition             = eventItem.MapPosition,
                AccessibleTransportLink = eventItem.AccessibleTransportLink
            };

            var description = _simpleTagParserContainer.ParseAll(eventItem.Description, eventItem.Title);

            description = _markdownWrapper.ConvertToHtml(description ?? "");
            description = _documentTagParser.Parse(description, eventItem.Documents);

            return(new ProcessedEvents(eventItem.Title, eventItem.Slug, eventItem.Teaser, eventItem.ImageUrl,
                                       eventItem.ThumbnailImageUrl, description, eventItem.Fee, eventItem.Location, eventItem.SubmittedBy,
                                       eventItem.EventDate, eventItem.StartTime, eventItem.EndTime, eventItem.Breadcrumbs, eventItem.Categories,
                                       mapDetails, eventItem.BookingInformation, eventItem.Group, eventItem.Alerts, eventItem.AccessibleTransportLink, eventItem.MetaDescription));
        }
コード例 #10
0
        public virtual ProcessedServicePayPayment Build(ServicePayPayment payment)
        {
            var description = _simpleTagParserContainer.ParseAll(payment.Description, payment.Title);

            description = _markdownWrapper.ConvertToHtml(description ?? "");

            return(new ProcessedServicePayPayment(
                       payment.Title,
                       payment.Slug,
                       payment.Teaser,
                       description,
                       payment.PaymentDetailsText,
                       payment.ReferenceLabel,
                       payment.BreadCrumbs,
                       payment.ReferenceValidation,
                       payment.MetaDescription,
                       payment.ReturnUrl,
                       payment.CatalogueId,
                       payment.AccountReference,
                       payment.PaymentDescription,
                       payment.Alerts,
                       payment.PaymentAmount));
        }
コード例 #11
0
        public virtual ProcessedShowcase Build(Showcase showcase)
        {
            var body = _tagParserContainer.ParseAll(showcase.Body);

            showcase.Body = _markdownWrapper.ConvertToHtml(body ?? string.Empty);

            var video = showcase.Video;

            if (video != null)
            {
                video.VideoEmbedCode = _tagParserContainer.ParseAll(video.VideoEmbedCode);
            }

            var fields = showcase.FieldOrder;

            if (!fields.Items.Any())
            {
                fields.Items.Add("Primary Items");
                fields.Items.Add("Secondary Items");
                fields.Items.Add("Featured Items");
                fields.Items.Add("News");
                fields.Items.Add("Events");
                fields.Items.Add("Profile");
                fields.Items.Add("Profiles");
                fields.Items.Add("Social Media");
                fields.Items.Add("Body");
                fields.Items.Add("Video");
                fields.Items.Add("Trivia");
            }

            return(new ProcessedShowcase(
                       showcase.Title,
                       showcase.Slug,
                       showcase.Teaser,
                       showcase.MetaDescription,
                       showcase.Subheading,
                       showcase.EventCategory,
                       showcase.EventsCategoryOrTag,
                       showcase.EventSubheading,
                       showcase.NewsSubheading,
                       showcase.NewsCategoryTag,
                       showcase.NewsCategoryOrTag,
                       showcase.BodySubheading,
                       showcase.Body,
                       showcase.NewsArticle,
                       showcase.HeroImageUrl,
                       showcase.SecondaryItems,
                       showcase.Breadcrumbs,
                       showcase.SocialMediaLinksSubheading,
                       showcase.SocialMediaLinks,
                       showcase.Events,
                       showcase.EmailAlertsTopicId,
                       showcase.EmailAlertsText,
                       showcase.Alerts,
                       showcase.PrimaryItems,
                       showcase.FeaturedItemsSubheading,
                       showcase.FeaturedItems,
                       showcase.Profile,
                       showcase.Profiles,
                       showcase.CallToActionBanner,
                       fields,
                       showcase.Icon,
                       showcase.TriviaSubheading,
                       _triviaFactory.Build(showcase.TriviaSection),
                       showcase.ProfileHeading,
                       showcase.ProfileLink,
                       showcase.EventsReadMoreText,
                       video,
                       showcase.TypeformUrl,
                       showcase.SpotlightBanner
                       ));
        }