Example #1
0
 public static TagBuilder RenderNotice(this HtmlHelper helper, string key, NoticeDefinition definition)
 {
     return RenderNotice(key, definition);
 }
Example #2
0
 public static NoticeDefinition Notify(this IDictionary<string, object> data, string key)
 {
     var not = new NoticeDefinition();
     data[DefaultNotificationFormat.AsFormat(key)] = not;
     return not;
 }
Example #3
0
        public static TagBuilder RenderNotice(string key, NoticeDefinition definition)
        {
            if (definition != null)
            {
                var notice = new TagBuilder("div").WithClasses(key);

                if (definition.Title != null)
                {
                    var span = new TagBuilder("span").WithText(definition.Title);
                    notice.InnerHtml += span.ToString();
                }

                if (definition.Items != null && definition.Items.Count > 0)
                {
                    var ul = new TagBuilder("ul").WithHtml(
                      definition.Items.Aggregate(new StringBuilder(),
                        (str, y) => str.Append(new TagBuilder("li").WithText(y))).ToString());

                    notice.InnerHtml += ul.ToString();
                }
                return notice;
            }
            else return null; ;
        }