<commit_before>.section
  %table{ :width => 500, :cellpadding => 0, :cellspacing => 0 }
    %tr
      %td{ :valign => :top }
        .label.top.req Field label:
        = f.text_field :field_label, :style => "width:140px"
      %td= spacer
      %td{ :valign => :top }
        .label.top.req Field type:
        = f.select :form_field_type, Customfield.form_field_types.map{|a,b|[b[:name],a]}.sort{|a,b|a[0]<=>b[0]}, { :style => "width:140px", :disabled => @disabled }
    %tr
      %td{ :valign => :top, :colspan => 2 }
        .label.top.req Select Options (pipe separated):
        = f.text_field :select_options, :style => "width:300px"
    %tr
      %td{ :valign => :top }
        .label.top.req Required:
        = f.check_box :required
      %td= spacer
      %td{ :valign => :top }
        .label.top.req Disabled:
        = f.check_box :disabled
    %tr
      %td{ :valign => :top }
        .label.top.req Helper Info:
        = f.text_area :field_info

    = hook(:customfield_top_section_bottom, self, :f => f)
<commit_msg>Added javascript to control select options field properly, based on field type<commit_after>.section
  %table{ :width => 500, :cellpadding => 0, :cellspacing => 0 }
    %tr
      %td{ :valign => :top }
        .label.top.req Field label:
        = f.text_field :field_label, :style => "width:140px"
      %td= spacer
      %td{ :valign => :top }
        .label.top.req Field type:
        = f.select :form_field_type, Customfield.form_field_types.map{|a,b|[b[:name],a]}.sort{|a,b|a[0]<=>b[0]}, { :style => "width:140px", :disabled => @disabled }
    %tr
      %td{ :valign => :top, :colspan => 2 }
        .label.top.req Select Options (pipe separated):
        = f.text_field :select_options, :style => "width:300px"
    %tr
      %td{ :valign => :top }
        .label.top.req Required:
        = f.check_box :required
      %td= spacer
      %td{ :valign => :top }
        .label.top.req Disabled:
        = f.check_box :disabled
    %tr
      %td{ :valign => :top }
        .label.top.req Helper Info:
        = f.text_area :field_info

    = hook(:customfield_top_section_bottom, self, :f => f)

    :javascript
      Event.observe($('customfield_form_field_type'),'change',function(){
        var select_el = $('customfield_select_options');
        switch($('customfield_form_field_type').value){
          // fall-through switch statement for both 'select_list' and 'multi_select' (see this thread for info: http://www.webdeveloper.com/forum/showthread.php?t=191026)
          case "select_list":
          case "multi_select":
            select_el.show().previous().show().innerHTML = "Select Options (pipe separated):";
            break;
          case "checkbox":
            select_el.show().previous().show().innerHTML = "Checkbox Value:";
            break;
          default:
            select_el.hide().previous().hide();
        }
      });
      fireEvent($('customfield_form_field_type'), 'change');

{'fraction_non_alphanumeric': 0.16277495769881556, 'fraction_numerical': 0.01353637901861252, 'mean_word_length': 2.4858490566037736, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '929743', 'n_tokens_mistral': 1021, 'n_tokens_neox': 975, 'n_words': 209}