public void Process(TagHelperContext context, TagHelperOutput output, int numPageNumbers, String itemsPerPageOptions, String startItemsPerPage, String controllerName)
        {
            output.TagName = "nav";
            output.Attributes.Add(new TagHelperAttribute("data-hr-controller", controllerName));
            output.Attributes.SetAttribute("class", context.MergeClasses("clearfix"));
            if (!output.Attributes.ContainsName("aria-label"))
            {
                output.Attributes.SetAttribute("aria-label", "pages");
            }
            if (startItemsPerPage != null)
            {
                output.Attributes.SetAttribute("data-hr-config-startitemsperpage", startItemsPerPage);
            }
            output.PreContent.AppendHtml(StartContent);

            for (int i = 0; i < numPageNumbers; ++i)
            {
                output.PreContent.AppendHtml(String.Format(PageLine, i));
            }
            output.PostContent.AppendHtml(EndPageNumbers);

            var perPageStrings = itemsPerPageOptions.Split(Seps, StringSplitOptions.RemoveEmptyEntries);

            foreach (var perPage in perPageStrings.Select(i => i.Trim()))
            {
                output.PostContent.AppendHtml(String.Format(OptionLine, perPage));
            }

            output.PostContent.AppendHtml(End);
        }
Пример #2
0
 public void Process(TagHelperContext context, TagHelperOutput output)
 {
     output.TagName = "div";
     output.Attributes.SetAttribute("class", context.MergeClasses("modal fade"));
     output.Attributes.SetAttribute("tabindex", -1);
     output.Attributes.SetAttribute("role", "dialog");
     output.Attributes.SetAttribute("data-hr-controller", "hr-relogin");
     output.Attributes.SetAttribute("data-hr-toggle", "dialog");
     output.Content.AppendHtml(markup);
 }
Пример #3
0
        public void Process(TagHelperContext context, TagHelperOutput output, String hrToggle, bool addHeader, String titleText, String dialogClasses)
        {
            var modalGuid = Guid.NewGuid().ToString();

            output.TagName = "div";

            output.PreContent.AppendHtml(String.Format(PreContent, dialogClasses != null && dialogClasses != "" ? " " + dialogClasses : ""));
            if (addHeader)
            {
                output.PreContent.AppendHtml(String.Format(HeaderContent, modalGuid, titleText));
                output.Attributes.SetAttribute("aria-labelledby", modalGuid);
            }
            output.PostContent.AppendHtml(PostContent);

            output.Attributes.SetAttribute("class", context.MergeClasses("modal fade"));
            output.Attributes.Add("tabindex", "-1");
            output.Attributes.SetAttribute("role", "dialog");
            output.Attributes.SetAttribute("data-hr-toggle", hrToggle);
        }
Пример #4
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (openMarkup != null)
            {
                output.PreContent.AppendHtml(openMarkup);
            }

            if (closeMarkup != null)
            {
                output.PostContent.AppendHtml(closeMarkup);
            }

            output.TagName = tagName;
            output.Attributes.SetAttribute("data-hr-toggle", HrToggle);

            if (Visible)
            {
                output.Attributes.SetAttribute("data-hr-style-off", "display:none;");
            }
            else
            {
                var classes = context.AllAttributes["class"]?.Value;
                output.Attributes.SetAttribute("class", context.MergeClasses(hiddenStartClass));
                output.Attributes.SetAttribute("data-hr-style-on", onStyle);
            }

            if (!String.IsNullOrWhiteSpace(AriaLiveMessage))
            {
                output.Attributes.SetAttribute("aria-live", "off");
                if (AriaLiveMessageBeforeElement)
                {
                    CreateLiveMessage(output.PreElement);
                }
                else
                {
                    CreateLiveMessage(output.PostElement);
                }
            }
        }