Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Mvc.PagedList/Internal/BootstrapPagerHtmlGenerator.cs
/// <summary>
///     Generate the html content for a pager item.
/// </summary>
/// <param name="item">The pager item for rendering.</param>
/// <returns>The generated <see cref="IHtmlContent" /> for the <paramref name="item" />.</returns>
Generate the html content for a pager item.
Generate the html content for a pager item .
protected static IHtmlContent GeneratePagerItem(PagerRenderingItem item)
		{
			if (item == null)
				throw new ArgumentNullException(nameof(item));
			var itemTag = new TagBuilder("li");
			TagBuilder linkTag;
			if (item.State == PagerRenderingItemState.Active)
			{
				itemTag.AddCssClass("active"); 
				linkTag = new TagBuilder("span");
			}
			else if (CanLink(item))
			{
				linkTag = new TagBuilder("a");
				linkTag.Attributes["href"] = item.Link;
			}
			else
			{
				itemTag.AddCssClass("disabled"); 
				linkTag = new TagBuilder("span");
			}
			if (!string.Equals(item.Settings.GetValueOfDefault("disble-bootstrap-v4-class"), "true",
				StringComparison.OrdinalIgnoreCase))
			{
				itemTag.AddCssClass("page-item");
				linkTag.AddCssClass("page-link");
			}
			AppendAdditionalAttributes(itemTag, item.List.Settings, ItemAttributeSettingKeyPrefix);
			AppendAdditionalAttributes(linkTag, item.List.Settings, LinkAttributeSettingKeyPrefix);
			AppendAdditionalAttributes(itemTag, item.Settings, ItemAttributeSettingKeyPrefix);
			AppendAdditionalAttributes(linkTag, item.Settings, LinkAttributeSettingKeyPrefix);
			linkTag.InnerHtml.SetHtmlContent(item.Content);
			itemTag.InnerHtml.SetHtmlContent(linkTag);
			return itemTag;
		}
protected static IHtmlContent GeneratePagerItem ( PagerRenderingItem item ) { if ( item == null ) throw new ArgumentNullException ( nameof ( item ) ) ; var itemTag = new TagBuilder ( " " ) ; TagBuilder linkTag ; if ( item . State == PagerRenderingItemState . Active ) { itemTag . AddCssClass ( " " ) ; linkTag = new TagBuilder ( " " ) ; } else if ( CanLink ( item ) ) { linkTag = new TagBuilder ( " " ) ; linkTag . Attributes [ " " ] = item . Link ; } else { itemTag . AddCssClass ( " " ) ; linkTag = new TagBuilder ( " " ) ; } if ( ! string . Equals ( item . Settings . GetValueOfDefault ( " " ) , " " , StringComparison . OrdinalIgnoreCase ) ) { itemTag . AddCssClass ( " " ) ; linkTag . AddCssClass ( " " ) ; } AppendAdditionalAttributes ( itemTag , item . List . Settings , ItemAttributeSettingKeyPrefix ) ; AppendAdditionalAttributes ( linkTag , item . List . Settings , LinkAttributeSettingKeyPrefix ) ; AppendAdditionalAttributes ( itemTag , item . Settings , ItemAttributeSettingKeyPrefix ) ; AppendAdditionalAttributes ( linkTag , item . Settings , LinkAttributeSettingKeyPrefix ) ; linkTag . InnerHtml . SetHtmlContent ( item . Content ) ; itemTag . InnerHtml . SetHtmlContent ( linkTag ) ; return itemTag ; }
Generate the html content for a pager item.
Generate the html content for a pager item .
// Container // Generate <a> or <span> according to its state // active CSS class // Disabled core CSS class // Add Bootstrap v4 classes, this is not confict with bootstrap v3. However user may choose to diable it manually. // Append father settings // Append all additional attributes // Set real content and merge elements
The generated  for the .
The generated for the .
item
PagerRenderingItem
The pager item for rendering.
The pager item for rendering .