public string Parse(string content, IEnumerable <Alert> alertsInline)
        {
            var matches = TagRegex.Matches(content);

            foreach (Match match in matches)
            {
                var tagDataIndex      = 1;
                var AlertsInlineTitle = match.Groups[tagDataIndex].Value;
                var AlertsInline      = GetAlertsInlineMatchingTitle(alertsInline, AlertsInlineTitle);
                if (AlertsInline != null)
                {
                    var alertsInlineHtml = "";
                    if (_featureToggles.SemanticInlineAlert)
                    {
                        alertsInlineHtml = _viewRenderer.Render("Semantic/AlertsInline", AlertsInline);
                    }
                    else
                    {
                        alertsInlineHtml = _viewRenderer.Render("AlertsInline", AlertsInline);
                    }

                    content = TagRegex.Replace(content, alertsInlineHtml, 1);
                }
            }
            return(RemoveEmptyTags(content));
        }
Exemple #2
0
 public IActionResult Remove(string id)
 {
     try {
         return(new JsonResult(new HtmlString(_viewRender.Render("Dashboard/Remove",
                                                                 new FormViewModel {
             Id = id
         }).AjustHtml())));
     } catch (Exception e) {
         SetMessage(e.Message, Models.Core.MsgType.Error);
         return(RedirectToAction(nameof(Index)));
     }
 }
Exemple #3
0
        private string RenderMailTemplate(string verificationUrl)
        {
            var model = new {
                Name             = "Tester",
                VerificationLink = verificationUrl
            };

            return(_viewRenderer.Render("MailTemplates/RegistrationVerificationMail", model));
        }
        public void Parse(IContactUsMessageContainer model, string message, string slug)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }
            var htmlMessage = _viewRenderer.Render("ContactUsMessage", message);

            model.AddContactUsMessage(htmlMessage, slug);
        }
        protected string GenerateHtml(string serviceEmailId)
        {
            if (string.IsNullOrEmpty(serviceEmailId))
            {
                _logger.LogError("The service email ID in this CONTACT-US tag is invalid and this contact form will not render.");
                return(UnableToRenderFormError);
            }
            var renderResult = _viewRenderer.Render("ContactUs", new ContactUsDetails(serviceEmailId, _articleTitle));

            return(string.Concat(ContactUsMessageTagRegex.ToString(), renderResult));
        }
Exemple #6
0
        public string Parse(string content, IEnumerable <Profile> profiles)
        {
            var matches = TagRegex.Matches(content);

            foreach (Match match in matches)
            {
                var tagDataIndex = 1;
                var profileSlug  = match.Groups[tagDataIndex].Value;
                var profile      = GetProfileMatchingSlug(profiles, profileSlug);
                if (profile != null)
                {
                    var profileHtml = string.IsNullOrEmpty(profile.Body)
                        ? _viewRenderer.Render("ProfileWithoutBody", profile)
                        : _viewRenderer.Render("Profile", profile);

                    content = TagRegex.Replace(content, profileHtml, 1);
                }
            }
            return(RemoveEmptyTags(content));
        }
 /// <summary>
 /// Load Attribute rendered form via service
 /// </summary>
 /// <param name="count"></param>
 /// <returns>Json Result</returns>
 public IActionResult Attribute(int count)
 {
     try
     {
         return(new JsonResult(new HtmlString(viewRender.Render("Forms/Attribute",
                                                                new ComponentBase {
             Counter = count
         }).AjustHtml())));
     }
     catch (Exception e)
     {
         SetMessage(e.Message, MsgType.Error); return(RedirectToAction("Index"));
     }
 }
Exemple #8
0
        public string Parse(string content, IEnumerable <S3BucketSearch> searches)
        {
            var matches = TagRegex.Matches(content);

            foreach (Match match in matches)
            {
                var search = searches.FirstOrDefault();

                if (search != null)
                {
                    search.SearchFolder = match.Groups[0].ToString().Replace("{{Search:", "").Replace("}}", "");
                    var searchHtml = _viewRenderer.Render("S3Bucket", search);
                    content = TagRegex.Replace(content, searchHtml, 1);
                }
            }
            return(RemoveEmptyTags(content));
        }
Exemple #9
0
        public string Parse(string content, IEnumerable <PrivacyNotice> privacyNotices)
        {
            var matches = TagRegex.Matches(content);

            foreach (Match match in matches)
            {
                var privacyNoticeSlug = match.Groups[1].Value;

                privacyNotices = privacyNotices.Where(s => s.Title.Replace(" ", string.Empty) == privacyNoticeSlug).OrderBy(x => x.Category);

                if (privacyNotices.Any())
                {
                    var privacyNoticeHtml = _viewRenderer.Render("PrivacyNotice", privacyNotices);
                    content = TagRegex.Replace(content, privacyNoticeHtml, 1);
                }
            }
            return(RemoveEmptyTags(content));
        }
Exemple #10
0
        public string Parse(string body, IEnumerable <InlineQuote> dynamicContent)
        {
            var matches = _tagRegex.Matches(body);

            foreach (Match match in matches)
            {
                var tagSlug     = match.Groups[1].Value;
                var inlineQuote = dynamicContent.FirstOrDefault(_ => _.Slug == tagSlug);

                if (inlineQuote != null)
                {
                    var renderedInlineQuote = _viewRenderer.Render("InlineQuote", inlineQuote);
                    body = _tagRegex.Replace(body, renderedInlineQuote, 1);
                }
            }

            return(RemoveEmptyTags(body));
        }
Exemple #11
0
        public string Success()
        {
            var html = _view.Render("Modal/success", new { Title = "Success", Message = "" });

            return(html);
        }
Exemple #12
0
        public string Render <TViewModel>(string viewName, TViewModel model)
        {
            var result = _viewRender.Render(viewName, model);

            return(result);
        }
Exemple #13
0
        private string ReplaceTagWithHtml(string content, Document document)
        {
            var documentHtml = _viewRenderer.Render("Document", document);

            return(TagRegex.Replace(content, documentHtml, 1));
        }