Ejemplo n.º 1
0
        /// <inheritdoc />
        public IHtmlContent RouteLink(
            string linkText,
            string routeName,
            string protocol,
            string hostName,
            string fragment,
            object routeValues,
            object htmlAttributes)
        {
            if (linkText == null)
            {
                throw new ArgumentNullException(nameof(linkText));
            }

            var tagBuilder = _htmlGenerator.GenerateRouteLink(
                ViewContext,
                linkText,
                routeName,
                protocol,
                hostName,
                fragment,
                routeValues,
                htmlAttributes);

            if (tagBuilder == null)
            {
                return(HtmlString.Empty);
            }

            return(tagBuilder);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public HtmlString RouteLink(
            [NotNull] string linkText,
            string routeName,
            string protocol,
            string hostName,
            string fragment,
            object routeValues,
            object htmlAttributes)
        {
            var tagBuilder = _htmlGenerator.GenerateRouteLink(
                linkText,
                routeName,
                protocol,
                hostName,
                fragment,
                routeValues,
                htmlAttributes);

            if (tagBuilder == null)
            {
                return(HtmlString.Empty);
            }

            return(tagBuilder.ToHtmlString(TagRenderMode.Normal));
        }
Ejemplo n.º 3
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var provider = _providerFactory.Get(Provider);

            var routeName  = $"NogginAuth_Redirect_{Provider}";
            var tagBuilder = _generator.GenerateRouteLink(ViewContext, "Provider link", routeName, null, null, null, null, null);

            output.TagName = "a";
            //output.MergeAttributes(tagBuilder);
            output.Attributes.SetAttribute("href", tagBuilder.Attributes["href"]);
        }
Ejemplo n.º 4
0
        private TagBuilder GenerateActionLink(RouteValueDictionary routeValues)
        {
            // Link for default culture needs to be generated by route name in order to not put culture into query string
            if (string.Equals(CultureName, CultureHelper.GetDefaultCultureCode(siteService.CurrentSite.SiteName), StringComparison.InvariantCultureIgnoreCase))
            {
                routeValues.Remove("culture");
                return(htmlGenerator.GenerateRouteLink(ViewContext, LinkText, Startup.DEFAULT_WITHOUT_LANGUAGE_PREFIX_ROUTE_NAME, null, null, null, routeValues, null));
            }

            // Ensure correct culture prefix
            routeValues["culture"] = CultureName;
            return(htmlGenerator.GenerateActionLink(ViewContext, LinkText, null, null, null, null, null, routeValues, null));
        }
Ejemplo n.º 5
0
 public TagBuilder GenerateRouteLink(ViewContext viewContext, string linkText, string routeName, string protocol, string hostName, string fragment, object routeValues, object htmlAttributes)
 {
     return(_htmlGenerator.GenerateRouteLink(viewContext, linkText, routeName, protocol, hostName, fragment, routeValues, htmlAttributes));
 }