private static MvcHtmlString CountSearchControlInternal(FindOptions findOptions, Web.CountSearchControl options, Context context) { findOptions.SearchOnLoad = true; HtmlStringBuilder sb = new HtmlStringBuilder(); if (options.Navigate) { sb.Add(new HtmlTag("a").Id(context.Prefix) .Class("count-search") .Attr("href", options.Href.HasText() ? options.Href : findOptions.ToString()) .SetInnerText("...")); } else { sb.Add(new HtmlTag("span").Id(context.Prefix) .Class("count-search") .SetInnerText("...")); } if (options.View) { sb.Add(new HtmlTag("a", context.Compose("csbtnView")) .Class("sf-line-button sf-view") .Attr("title", EntityControlMessage.View.NiceToString()) .Attr("onclick", JsModule.Finder["explore"](findOptions.ToJS(context.Compose("New"))).ToString()) .InnerHtml(new HtmlTag("span").Class("glyphicon glyphicon-arrow-right"))); } var function = new JsFunction(JsModule.Finder, "count", findOptions.ToJS(context.Prefix), new JRaw("'" + context.Prefix + "'.get()")); sb.Add(MvcHtmlString.Create("<script>" + function.ToHtmlString() + "</script>")); return(sb.ToHtml()); }
private static MvcHtmlString CountSearchControlInternal(FindOptions findOptions, Web.CountSearchControl options) { findOptions.SearchOnLoad = true; int count = Navigator.QueryCount(new CountOptions(findOptions.QueryName) { FilterOptions = findOptions.FilterOptions }); HtmlStringBuilder sb = new HtmlStringBuilder(); if (options.Navigate) { sb.Add(new HtmlTag("a") .Class("count-search").Class(count > 0 ? "count-with-results badge" : "count-no-results") .Attr("href", options.Href.HasText() ? options.Href : findOptions.ToString()) .SetInnerText(count.ToString())); } else { sb.Add(new HtmlTag("span") .Class("count-search").Class(count > 0 ? "count-with-results badge" : "count-no-results") .SetInnerText(count.ToString())); } if (options.PopupViewPrefix != null) { sb.Add(new HtmlTag("a", options.PopupViewPrefix + "csbtnView") .Class("sf-line-button sf-view") .Attr("title", EntityControlMessage.View.NiceToString()) .Attr("onclick", new JsFunction(JsFunction.FinderModule, "explore", findOptions.ToJS(options.PopupViewPrefix)).ToString()) .InnerHtml(new HtmlTag("span").Class("glyphicon glyphicon-arrow-right"))); } return sb.ToHtml(); }
private static MvcHtmlString CountSearchControlInternal(FindOptions findOptions, Web.CountSearchControl options, Context context) { findOptions.SearchOnLoad = true; HtmlStringBuilder sb = new HtmlStringBuilder(); if (options.Navigate) { sb.Add(new HtmlTag("a").Id(context.Prefix) .Class("count-search") .Attr("href", options.Href.HasText() ? options.Href : findOptions.ToString()) .SetInnerText("...")); } else { sb.Add(new HtmlTag("span").Id(context.Prefix) .Class("count-search") .SetInnerText("...")); } if (options.View) { sb.Add(new HtmlTag("a", context.Compose("csbtnView")) .Class("sf-line-button sf-view") .Attr("title", EntityControlMessage.View.NiceToString()) .Attr("onclick", JsModule.Finder["explore"](findOptions.ToJS(context.Compose("New"))).ToString()) .InnerHtml(new HtmlTag("span").Class("glyphicon glyphicon-arrow-right"))); } var function = new JsFunction(JsModule.Finder, "count", findOptions.ToJS(context.Prefix), new JRaw("'" + context.Prefix + "'.get()")); sb.Add(MvcHtmlString.Create("<script>" + function.ToHtmlString() + "</script>")); return sb.ToHtml(); }