本文整理汇总了C#中IContent.HtmlDescription方法的典型用法代码示例。如果您正苦于以下问题:C# IContent.HtmlDescription方法的具体用法?C# IContent.HtmlDescription怎么用?C# IContent.HtmlDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContent
的用法示例。
在下文中一共展示了IContent.HtmlDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetViewHtml
public string GetViewHtml(IContent content, Target target)
{
if (content == null)
return null;
var poll = InternalApi.PollingService.GetPoll(content.ContentId);
if (poll == null) return string.Empty;
var user = TEApi.Users.Get(new UsersGetOptions { Id = poll.AuthorUserId });
var group = TEApi.Groups.Get(poll.ApplicationId);
var sb = new StringBuilder(@"<div class=""content abbreviated rendered poll"">");
sb.Append(@"<div class=""author"">");
sb.Append(@"<div class=""avatar"">");
sb.AppendFormat(@"<a href=""{0}"" class=""internal-link view-user-profile"">{1}</a>", TEApi.Html.EncodeAttribute(user.Url), TEApi.UI.GetResizedImageHtml(user.AvatarUrl, 44, 44, new UiGetResizedImageHtmlOptions { OutputIsPersisted = false, ResizeMethod = "ZoomAndCrop" }));
sb.Append(@"</div>");
sb.AppendFormat(@"<span class=""user-name""><a href=""{0}"" class=""internal-link view-user-profile"">{1}</a></span>", TEApi.Html.EncodeAttribute(user.Url), user.DisplayName);
sb.Append(@"</a></div>");
sb.Append(@"<div class=""attributes""><ul class=""attribute-list"">");
sb.AppendFormat(@"<li class=""attribute-item date"">{0}</li>", TEApi.Language.FormatAgoDate(poll.CreatedDateUtc.ToLocalTime()));
sb.AppendFormat(@"<li class=""attribute-item container"">{0} <a href=""{1}"">{2}</a></li>", _translation.GetLanguageResourceValue("In"), TEApi.Html.EncodeAttribute(group.Url), group.Name);
sb.Append(@"</ul></div>");
sb.AppendFormat(
@"<h3 class=""name""><a class=""internal-link"" title=""{0}"" href=""{1}"">{0}</a></h3>",
content.HtmlName("Web"), TEApi.Html.EncodeAttribute((InternalApi.PollingUrlService.PollUrl(poll.Id))));
sb.AppendFormat(@"<div class=""content empty"">{0}</div>", TEApi.Language.Truncate(content.HtmlDescription("Web"), 200, "..."));
//PublicApi.Polls.UI(poll.Id, true, false)
sb.Append("</div>");
return sb.ToString();
}