Example #1
0
        public static MvcHtmlString SlideShowOnPage(this HtmlHelper helper, List<SSD.Web.PictureCore> lstPics, ThemesSlideShowOnPage theme)
        {
            var html = new TagBuilder("div");
            html.MergeAttribute("class", "slider-wrapper " + GetThemesSlideShowOnPage(theme));
            if (lstPics.Count > 0)
            {
                var str = new StringBuilder("<div class=\"ribbon\"></div><div id=\"sliderOnPage\" class=\"nivoSlider\">");
                foreach (var pic in lstPics)
                {
                    if (!string.IsNullOrWhiteSpace(pic.LinkReference))
                        str.AppendFormat("<a href=\"{0}\" title = \"{1}\">", pic.LinkReference, pic.DisplayName);
                    str.AppendFormat("<img src=\"{0}\" alt=\"{1}\" title=\"#htmlcaption{2}\" />", pic.ImgUrl, pic.DisplayName, pic.PictureID);
                    if (!string.IsNullOrWhiteSpace(pic.LinkReference))
                        str.Append("</a>");
                }
                str.Append("</div>");
                foreach (var pic in lstPics)
                {
                    if (!string.IsNullOrWhiteSpace(pic.Description))
                    {
                        str.AppendFormat("<div id=\"htmlcaption{0}\" class=\"nivo-html-caption\">{1}</div>", pic.PictureID, pic.Description);
                    }
                }
                str.Append("<script type=\"text/javascript\">")
                    .Append("$(window).load(function() { $('#sliderOnPage').nivoSlider(); });")
                    .Append("</script>");

                html.InnerHtml = str.ToString();
            }
            return new MvcHtmlString(html.ToString(TagRenderMode.Normal));
        }
Example #2
0
 private static string GetThemesSlideShowOnPage(ThemesSlideShowOnPage theme)
 {
     switch (theme)
     {
         case ThemesSlideShowOnPage.Orman:
             return "theme-orman";
         case ThemesSlideShowOnPage.Pascal:
             return "theme-pascal";
         default:
             return "theme-default";
     }
 }