<commit_before>﻿using System;
using System.Web;
using System.Web.Mvc;
using ChameleonForms.Component.Config;
using ChameleonForms.Enums;
using ChameleonForms.FieldGenerators;
using ChameleonForms.FieldGenerators.Handlers;

namespace ChameleonForms.Templates
{
    /// <summary>
    /// The default Chameleon Forms form template renderer.
    /// </summary>
    public class TwitterBootstrapFormTemplate : DefaultFormTemplate
    {
        public override void PrepareFieldConfiguration<TModel, T>(IFieldGenerator<TModel, T> fieldGenerator, IFieldGeneratorHandler<TModel, T> fieldGeneratorHandler, IFieldConfiguration fieldConfiguration)
        {
            //TODO: Only for inputs and textareas
            fieldConfiguration.AddClass("form-control");
        }

        public override IHtmlString BeginForm(string action, FormMethod method, HtmlAttributes htmlAttributes, EncType? enctype)
        {
            return HtmlCreator.BuildFormTag(action, method, htmlAttributes, enctype);
        }

        public override IHtmlString EndForm()
        {
            return TwitterBootstrapHtmlHelpers.EndForm();
        }
<commit_msg>Added some conditional logic to apply the form-control class in the Twitter Bootstrap template - still need to look at bools and select's<commit_after>﻿using System;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChameleonForms.Component.Config;
using ChameleonForms.Enums;
using ChameleonForms.FieldGenerators;
using ChameleonForms.FieldGenerators.Handlers;

namespace ChameleonForms.Templates
{
    /// <summary>
    /// The default Chameleon Forms form template renderer.
    /// </summary>
    public class TwitterBootstrapFormTemplate : DefaultFormTemplate
    {
        public override void PrepareFieldConfiguration<TModel, T>(IFieldGenerator<TModel, T> fieldGenerator, IFieldGeneratorHandler<TModel, T> fieldGeneratorHandler, IFieldConfiguration fieldConfiguration)
        {
            if (new[] { typeof(DateTimeHandler<TModel, T>), typeof(DefaultHandler<TModel, T>), typeof(PasswordHandler<TModel, T>), typeof(TextAreaHandler<TModel, T>) }.Any(t => t.IsInstanceOfType(fieldGeneratorHandler)))
                fieldConfiguration.AddClass("form-control");
        }

        public override IHtmlString BeginForm(string action, FormMethod method, HtmlAttributes htmlAttributes, EncType? enctype)
        {
            return HtmlCreator.BuildFormTag(action, method, htmlAttributes, enctype);
        }

        public override IHtmlString EndForm()
        {
            return TwitterBootstrapHtmlHelpers.EndForm();
        }

{'fraction_non_alphanumeric': 0.08217592592592593, 'fraction_numerical': 0.0, 'mean_word_length': 3.766544117647059, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '413061', 'n_tokens_mistral': 694, 'n_tokens_neox': 684, 'n_words': 169}