示例#1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var field = For.Name;
            InputFieldConfiguration configuration;

            configuration = _inputFieldsConfiguration.GetConfigurationFor(field);

            // Ako nisam nasao konfiguraciju uzimam default - samo za display name uzimam ime propertija
            if (configuration == null)
            {
                configuration = new InputFieldConfiguration {
                    DisplayName = field
                };
            }

            var propertyName   = field.ToCamelCase();
            var labelHtml      = _labelHtmlGenerator.Generate(propertyName, configuration);
            var inputHtml      = _inputFieldHtmlGenerator.Generate(propertyName, configuration);
            var validationHtml = _inputFieldValidationGenerator.Generate(propertyName, configuration);

            var sb = new StringBuilder();

            sb.AppendLine($"<div class=\"form-group\">");
            sb.AppendLine(labelHtml);
            sb.AppendLine($"<div class=\"{configuration.InputClass}\">");
            sb.AppendLine(inputHtml);
            //sb.AppendLine(validationHtml);
            sb.AppendLine($"</div>");
            sb.AppendLine($"</div>");


            output.TagName = "";
            output.TagMode = TagMode.StartTagAndEndTag;
            output.Content.SetHtmlContent(sb.ToString());
        }
示例#2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var field = For.Name;
            InputFieldConfiguration configuration;

            configuration = _inputFieldsConfiguration.GetConfigurationFor(field);

            // Ako nisam nasao konfiguraciju uzimam default - samo za display name uzimam ime propertija
            if (configuration == null)
            {
                configuration = new InputFieldConfiguration {
                    DisplayName = field
                };
            }

            var propertyName = field.ToCamelCase();
            var labelHtml    = _labelHtmlGenerator.Generate(propertyName, configuration);

            output.TagName = "";
            output.TagMode = TagMode.StartTagAndEndTag;
            output.Content.SetHtmlContent(labelHtml);
        }