public static HtmlString GetDefaultPagination( this HtmlHelper htmlHelper, int pageIndex, int totalCount, int pageSize, PaginationSizing paginationSizing, PaginationAligment paginationAligment, int numericLinksCount, bool paginationInfo, object htmlAttributes, BootstrapVersion bootstrapVersion, string onClick, bool href, Uri currentUrl, string[] removedParameters, Dictionary <string, string> addedParameters) { return(Pagination.GetDefaultPagination(pageIndex, totalCount, pageSize, paginationSizing, paginationAligment, numericLinksCount, paginationInfo, htmlAttributes, bootstrapVersion, onClick, href, currentUrl, removedParameters, addedParameters)); }
public static HtmlString GetDefaultPagination( this HtmlHelper htmlHelper, int pageIndex, int totalCount, int pageSize, PaginationSizing paginationSizing, PaginationAligment paginationAligment, int numericLinksCount, bool paginationInfo, object htmlAttributes, BootstrapVersion bootstrapVersion, string onClick, bool href, Uri currentUrl, string[] removedParameters, Dictionary<string, string> addedParameters) { return Pagination.GetDefaultPagination(pageIndex, totalCount, pageSize, paginationSizing, paginationAligment, numericLinksCount, paginationInfo, htmlAttributes, bootstrapVersion, onClick, href, currentUrl, removedParameters, addedParameters); }
public BootstrapControlFormProvider(BootstrapVersion version = BootstrapVersion.Version3) { builder = new StringBuilder(); Version = version; switch (version) { case BootstrapVersion.Version2: GroupCssClass = "control-group"; LabelCssClass = "control-label"; ControlsCssClass = "controls"; break; case BootstrapVersion.Version3: GroupCssClass = "form-group"; LabelCssClass = "col-lg-3 col-sm-3 col-md-3 col-xs-3 control-label"; controlCssClass = "form-control"; ControlsCssClass = "col-lg-9 col-sm-9 col-md-9 col-xs-9"; break; default: throw new ArgumentOutOfRangeException("version"); } }
public Configuration BootstrapVersion(BootstrapVersion value) { _bootstrapVersion = value; return this; }
public Configuration() { _bootstrapVersion = FluentMvcGrid.BootstrapVersion.Bootstrap3; _whiteSpace = FluentMvcGrid.WhiteSpace.None; }
public virtual TBuilder ComponentVersion(BootstrapVersion value) { this.Component.ComponentVersion = value; return(this as TBuilder); }
public static HtmlString GetDefaultPagination(int pageIndex, int totalCount, int pageSize, PaginationSizing paginationSizing, PaginationAligment paginationAligment, int numericLinksCount, bool paginationInfo, object htmlAttributes, BootstrapVersion bootstrapVersion, string onClick, bool href, Uri currentUrl, string[] removedParameters, Dictionary<string, string> addedParameters) { if (currentUrl == null) { currentUrl = HttpContext.Current.Request.Url; } var pageCount = CalculatePageCount(pageSize, totalCount); if (pageCount == 1) { return new HtmlString(""); } var div = new TagBuilder("div"); var ul = new TagBuilder("ul"); TagBuilder parentTag; if (bootstrapVersion == BootstrapVersion.Bootstrap2) { div.AddCssClass("pagination"); if (paginationAligment != PaginationAligment.Left) { div.AddCssClass(paginationAligment == PaginationAligment.Center ? "pagination-centered" : "pagination-right"); } parentTag = div; } else { ul.AddCssClass("pagination"); parentTag = ul; } var attributes = (IDictionary<string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); if (attributes != null) { if (attributes.ContainsKey("class")) { parentTag.AddCssClass(attributes["class"].ToString()); } parentTag.MergeAttributes(attributes); } switch (paginationSizing) { case PaginationSizing.Large: parentTag.AddCssClass("pagination-" + (bootstrapVersion == BootstrapVersion.Bootstrap2 ? "pagination-large" : "pagination-lg")); break; case PaginationSizing.Small: parentTag.AddCssClass("pagination-" + (bootstrapVersion == BootstrapVersion.Bootstrap2 ? "pagination-small" : "pagination-sm")); break; case PaginationSizing.Mini: if (bootstrapVersion == BootstrapVersion.Bootstrap2) { parentTag.AddCssClass("pagination pagination-mini"); } break; } var liClass = pageIndex == 1 ? "disabled" : ""; var parameters = Utilities.ParseQueryString(currentUrl.Query); RemoveParameters(parameters, removedParameters); AddParameters(parameters, addedParameters); var page = 1; parameters["page"] = page.ToString(); var path = currentUrl.LocalPath; var url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem("«", url, liClass, FluentMvcGridResources.First, onClick, href, page); var num = pageCount - 1; var num1 = pageIndex + numericLinksCount / 2; var num2 = num1 - numericLinksCount + 1; if (num1 > num) { num2 = num2 - (num1 - num); num1 = num; } if (num2 < 0) { num1 = Math.Min(num1 + -num2, num); num2 = 0; } for (var i = num2; i <= num1; i++) { var j = i + 1; var text = j.ToString(CultureInfo.InvariantCulture); liClass = pageIndex == j ? "active" : ""; if (j != pageIndex) { page = j; parameters["page"] = page.ToString(); url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem(text, url, liClass, null, onClick, href, page); } else { url = ""; ul.InnerHtml += GetPaginationItem(text, url, liClass, null, onClick, href, null); } } liClass = pageIndex == pageCount ? "disabled" : ""; page = pageCount; parameters["page"] = page.ToString(); url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem("»", url, liClass, FluentMvcGridResources.Last, onClick, href, page); if (paginationInfo) { var info = string.Format(FluentMvcGridResources.PaginationInfo, pageIndex, pageCount, totalCount); ul.InnerHtml += string.Format("<li class='disabled'><span>{0}</span></li>", info); } if (bootstrapVersion == BootstrapVersion.Bootstrap2) { div.InnerHtml = ul.ToString(); return new HtmlString(div.ToString()); } return new HtmlString(ul.ToString()); }
public Configuration BootstrapVersion(BootstrapVersion value) { _bootstrapVersion = value; return(this); }
public static HtmlString GetDefaultPagination(int pageIndex, int totalCount, int pageSize, PaginationSizing paginationSizing, PaginationAligment paginationAligment, int numericLinksCount, bool paginationInfo, object htmlAttributes, BootstrapVersion bootstrapVersion, string onClick, bool href, Uri currentUrl, string[] removedParameters, Dictionary <string, string> addedParameters) { if (currentUrl == null) { currentUrl = HttpContext.Current.Request.Url; } var pageCount = CalculatePageCount(pageSize, totalCount); if (pageCount == 1) { return(new HtmlString("")); } var div = new TagBuilder("div"); var ul = new TagBuilder("ul"); TagBuilder parentTag; if (bootstrapVersion == BootstrapVersion.Bootstrap2) { div.AddCssClass("pagination"); if (paginationAligment != PaginationAligment.Left) { div.AddCssClass(paginationAligment == PaginationAligment.Center ? "pagination-centered" : "pagination-right"); } parentTag = div; } else { ul.AddCssClass("pagination"); parentTag = ul; } var attributes = (IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); if (attributes != null) { if (attributes.ContainsKey("class")) { parentTag.AddCssClass(attributes["class"].ToString()); } parentTag.MergeAttributes(attributes); } switch (paginationSizing) { case PaginationSizing.Large: parentTag.AddCssClass("pagination-" + (bootstrapVersion == BootstrapVersion.Bootstrap2 ? "pagination-large" : "pagination-lg")); break; case PaginationSizing.Small: parentTag.AddCssClass("pagination-" + (bootstrapVersion == BootstrapVersion.Bootstrap2 ? "pagination-small" : "pagination-sm")); break; case PaginationSizing.Mini: if (bootstrapVersion == BootstrapVersion.Bootstrap2) { parentTag.AddCssClass("pagination pagination-mini"); } break; } var liClass = pageIndex == 1 ? "disabled" : ""; var parameters = Utilities.ParseQueryString(currentUrl.Query); RemoveParameters(parameters, removedParameters); AddParameters(parameters, addedParameters); var page = 1; parameters["page"] = page.ToString(); var path = currentUrl.LocalPath; var url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem("«", url, liClass, FluentMvcGridResources.First, onClick, href, page); var num = pageCount - 1; var num1 = pageIndex + numericLinksCount / 2; var num2 = num1 - numericLinksCount + 1; if (num1 > num) { num2 = num2 - (num1 - num); num1 = num; } if (num2 < 0) { num1 = Math.Min(num1 + -num2, num); num2 = 0; } for (var i = num2; i <= num1; i++) { var j = i + 1; var text = j.ToString(CultureInfo.InvariantCulture); liClass = pageIndex == j ? "active" : ""; if (j != pageIndex) { page = j; parameters["page"] = page.ToString(); url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem(text, url, liClass, null, onClick, href, page); } else { url = ""; ul.InnerHtml += GetPaginationItem(text, url, liClass, null, onClick, href, null); } } liClass = pageIndex == pageCount ? "disabled" : ""; page = pageCount; parameters["page"] = page.ToString(); url = Utilities.AppendParametersToUrl(path, parameters); ul.InnerHtml += GetPaginationItem("»", url, liClass, FluentMvcGridResources.Last, onClick, href, page); if (paginationInfo) { var info = string.Format(FluentMvcGridResources.PaginationInfo, pageIndex, pageCount, totalCount); ul.InnerHtml += string.Format("<li class='disabled'><span>{0}</span></li>", info); } if (bootstrapVersion == BootstrapVersion.Bootstrap2) { div.InnerHtml = ul.ToString(); return(new HtmlString(div.ToString())); } return(new HtmlString(ul.ToString())); }
public Configuration() { _bootstrapVersion = Core.BootstrapVersion.Bootstrap3; _whiteSpace = Core.WhiteSpace.None; }