public static MvcHtmlString MiniPager(this UrlHelper urlHelper, TopicOverviewViewModel topic, Func <int, string> linkBuilder) { //<i class="glyphicon glyphicon-play-circle"></i> const string FormatNormal = "<span class='topic-pager hidden-xs'><a class='btn btn-default btn-xs' href='{0}'>{1}</a></span>"; StringBuilder pagerBuilder = new StringBuilder(); if (!topic.ReadByCurrentUser) { pagerBuilder.AppendFormat( FormatNormal, urlHelper.Action(MVC.Forum.FirstNewPostInTopic().AddRouteValue("topicId", topic.Id)), Resources.Forums.GotoFirstNewPost + " <i class='glyphicon glyphicon-play'></i>"); } int numberOfPages = (int)Math.Ceiling(topic.PostCount / (double)ForumOptions.PostsPerPage); if (numberOfPages <= 1) { return(MvcHtmlString.Empty); } for (int page = 1; page <= numberOfPages; page++) { pagerBuilder.AppendFormat(FormatNormal, linkBuilder(page), page); } return(MvcHtmlString.Create(pagerBuilder.ToString())); }
public static string TopicIconTitle(TopicOverviewViewModel topic) { if (topic.DisplayPriority == TopicDisplayPriority.Sticky) { return(!topic.ReadByCurrentUser ? @Resources.Forums.StickyNewPosts : @Resources.Forums.StickyNoNewPosts); } return(!topic.ReadByCurrentUser ? @Resources.Forums.NewPosts : @Resources.Forums.NoNewPosts); }
public static string TopicIconClass(TopicOverviewViewModel topic) { if (topic.DisplayPriority == TopicDisplayPriority.Sticky) { return(topic.ReadByCurrentUser ? "glyphicon glyphicon-exclamation-sign text-muted" : "glyphicon glyphicon-exclamation-sign text-primary"); } if (!topic.ReadByCurrentUser) { return("glyphicon glyphicon-eye-open text-primary"); } return("glyphicon glyphicon-eye-close text-muted"); }