/// <summary> /// Renders the specified albums. /// </summary> /// <param name="uploads">The uploads.</param> /// <param name="username">The username.</param> /// <returns></returns> public static string Render(IList <RecentUploads> uploads, string username) { StringBuilder builder = new StringBuilder(); uploads = uploads.OrderByDescending(o => o.CreateDate).ToList(); if (uploads == null) { throw new System.ArgumentNullException("uploads", "Parameter 'uploads' is null, value expected"); } if (uploads.Count > 0) { string albumUrl = _urlService.CreateUrl(username, "recent"); builder.AppendLine(string.Format("<h3><a href=\"{0}\" >recent uploads</a></h3>", albumUrl)); string val = BuildUpload(uploads); builder.AppendLine("<table class=\"recent\" ><tbody>"); builder.AppendLine(val); builder.AppendLine("</tbody></table>"); builder.AppendLine(uploads.Count > 4 ? string.Format("<p class=\"clearboth marginbottom40\" ><a href=\"{0}/#/\" title=\"view additional uploads\">more...</a></p>", albumUrl) : "<br class=\"clearboth\" />"); } return(builder.ToString()); }
/// <summary> /// Renders the specified albums. /// </summary> /// <param name="albums">The albums.</param> /// <param name="username">The username.</param> /// <returns></returns> public static string Render(IList <Album> albums, string username) { StringBuilder builder = new StringBuilder(); if (albums == null) { throw new System.ArgumentNullException("albums", "Parameter 'albums' is null, value expected"); } if (albums.Count > 0) { string albumUrl = _urlService.CreateUrl(username, "albums"); builder.AppendLine(string.Format("<h3><a href=\"{0}\" >albums</a></h3>", albumUrl)); string val = BuildAlbum(albums); builder.AppendLine("<table class=\"albumwidget\" ><tbody>"); builder.AppendLine(val); builder.AppendLine("</tbody></table>"); builder.AppendLine(albums.Count > 4 ? string.Format("<p class=\"clearboth marginbottom40\" ><a href=\"{0}/#/\" title=\"view more albums\">more...</a></p>", albumUrl) : "<br class=\"clearboth\" />"); } return(builder.ToString()); }
/// <summary> /// Renders the numeric paging. /// </summary> /// <param name="numericPaging">The numeric paging.</param> /// <param name="user">The user.</param> /// <param name="letter">The letter.</param> /// <returns></returns> public static string RenderNumericPaging(NumericPaging numericPaging, User user, char letter) { string paging = string.Empty; if (!(numericPaging.PageSize > numericPaging.TotalCount)) { IUserUrlService urlService = UserUrlService.GetInstance(user); int pages = Convert.ToInt32(Math.Ceiling(numericPaging.TotalCount / Convert.ToDecimal(numericPaging.PageSize))); const string linkFormat = "<li><a href=\"{0}\" title=\"View page {1}\" {3} >{2}</a></li>"; StringBuilder builder = new StringBuilder(); for (int index = 1; index <= pages; index++) { string selectedText = (numericPaging.CurrentPage == index ? "class=\"active\"" : string.Empty); builder.AppendLine(string.Format(linkFormat, urlService.CreateUrl("tags/show/" + letter + "?page=" + index), index, index, selectedText)); } paging = builder.ToString(); } return(paging); }
/// <summary> /// Renders the alphabet paging. /// </summary> /// <param name="alphabetPages">The alphabet pages.</param> /// <param name="user">The user.</param> /// <returns></returns> public static string RenderAlphabetPaging(AlphabetPagingView alphabetPages, User user) { IUserUrlService urlService = UserUrlService.GetInstance(user); StringBuilder builder = new StringBuilder(); builder.AppendLine("<ul class=\"alphabet\">"); const string haveTagsFormat = "<li {1} ><a href=\"{2}\" >{0}</a></li>"; const string doesntHaveTagsFormat = "<li>{0}</li>"; foreach (AlphabetPage alphabetPage in alphabetPages.AlphabetPages) { string isSelected = (alphabetPage.Letter.Equals(alphabetPages.SelectedLetter.ToString(), StringComparison.InvariantCultureIgnoreCase) ? "class=\"selected\"" : string.Empty); builder.AppendLine(alphabetPage.MediaCount > 0 ? string.Format(haveTagsFormat, alphabetPage.Letter, isSelected, urlService.CreateUrl("tags/show/" + alphabetPage.Letter)) : string.Format(doesntHaveTagsFormat, alphabetPage.Letter)); } builder.AppendLine("</ul>"); return(builder.ToString()); }
/// <summary> /// Renders the specified tags. /// </summary> /// <param name="tags">The tags.</param> /// <param name="username">The username.</param> /// <returns></returns> public static string Render(IList <Tag> tags, string username) { IUserUrlService urlService = UserUrlService.GetInstance(); StringBuilder builder = new StringBuilder(); if (tags == null) { throw new System.ArgumentNullException("tags", "Parameter 'tags' is null, value expected"); } if (tags.Count > 0) { builder.AppendLine(string.Format("<div class=\"marginbottom40\" ><h3 class=\"tagallhack\" ><a href=\"{0}\">tags</a></h3> ", urlService.CreateUrl(username, "tags"))); builder.AppendLine("<p style='text-align:right;margin-top:3px;' ><label id='filtertags' >filter:</label><input type='text' id='tagfilter' /></p> "); const string tagFormat = "<span class=\"tagWrapper\" ><a href=\"/{0}/tagged/{1}\" rel=\"{2}\" title=\"view photos tagged '{1}'\" class=\"tag\">{1}</a>{3}</span>"; for (int index = 0; index < tags.Count; index++) { builder.AppendLine(string.Format(tagFormat, username, tags[index].TagText, tags[index].Count, (index < tags.Count - 1 ? "<span class=\"comma\" >,</span>" : string.Empty))); } builder.AppendLine("</div>"); } return(builder.ToString()); }