示例#1
0
 /// <exclude />
 public static FluentTagBuilder GenerateGithubForkme(string repository, GithubForkmeSide side, GithubForkmeColor color)
 {
     return new FluentTagBuilder()
         .StartTag("a").Attribute("href", $"https://github.com/{repository}")
             .StartTag("img")
                 .Action(tag =>
                 {
                     if (side.Equals(GithubForkmeSide.Left))
                         tag.Style("position: absolute; top: 0; left: 0; border: 0; z - index:999999");
                     else
                         tag.Style("position: absolute; top: 0; right: 0; border: 0; z-index:999999");
                 })
                 .Attribute("src", $"https://s3.amazonaws.com/github/ribbons/forkme_{side.ToString().ToLower()}_{color.ToString().ToLower()}_{GithubForkmeImages[color]}.png")
                 .Attribute("alt", "Fork me on GitHub")
             .EndTag()
         .EndTag();
 }
 /// <summary>
 /// Returns the standard Github Forkme image banner.
 /// </summary>
 /// <param name="htmlHelper">The <see cref="IHtmlHelper"/> Instance this method extends.</param>
 /// <param name="repository">Github repository that will be used in the anchor.</param>
 /// <param name="side">The side of the window that the banner will be displayed.</param>
 /// <param name="color">The color of the banner.</param>
 /// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
 public static IHtmlContent GithubForkme(this IHtmlHelper htmlHelper, string repository, GithubForkmeSide side = GithubForkmeSide.Right, GithubForkmeColor color = GithubForkmeColor.Gray)
 {
     return new HtmlString(GenerateGithubForkme(repository, side, color));
 }