<commit_before><%= form.inputs do %>
  <%= form.input :title %>
  <%= form.input :type, :as => :select, :collection => ['Image', 'Frame', 'Text'] %>
  
  <div class="types image text hidden">
    <%= form.input :link %>
  </div>
  
  <div class="types frame <% unless section_module.type == "Frame" %>hidden<% end %>">
    <%= form.input :frame, :collection => {
                                          'Blog'    => 'blog',
                                          'Courses' => 'courses',
                                          'Events'  => 'events',
                                          'News'    => 'news'
                                        } %>
  </div>
  
  <div class="types image <% unless section_module.type == "Image" %>hidden<% end %>">

    <%= form.inputs "Image file" do %>
    
      <fieldset class='form-horizontal'>

        <% if section_module.image %>
          <div class='control-group'>
            <%= form.label "Current image", class: 'control-label' %>
            <div class='controls'>
              <%= link_to section_module.image.name, section_module.image.file_url %>
            </div>
          </div>

          <div class='control-group'>
            <%= form.label "Remove image?", class: 'control-label' %>
            <div class='controls'>
              <%= check_box_tag "section_module[remove_image]", "1" %>
            </div>
          </div>

        <% end %>

        <p><%= form.input :image, :as => :file, :label => section_module.image ? "Replace image" : "Upload a new image" %></p>

      </fieldset>
    
    <% end %>
    
  </div>
  
  <div class="types text <% unless section_module.type == "Text" %>hidden<% end %>">
    <%= form.input :text %>
    <%= form.input :colour, :as => :select, :collection =>  {
                                            'Red'          => 1,
                                            'Orange'       => 2,
                                            'Yellow'       => 3,
                                            'Light Green'  => 4,
                                            'Medium Green' => 5,
                                            'Turquoise'    => 6,
                                            'Dark Blue'    => 7,
                                            'Medium Blue'  => 8,
                                            'Light Blue'   => 9,
                                            'Pink'         => 10,
                                            'Magenta'      => 11,
                                            'Purple'       => 12
                                          }
    %>
  </div>
  
  <%= form.submit :value => "Save", :class => "btn btn-success" %>
<% end %>

<%= content_for :extra_javascript do %>
  <script type="text/javascript">
    $("#section_module_type").change(function() {
      $('.types').addClass('hidden');
      $('.' + this.value.toLowerCase()).removeClass('hidden');
    })
  </script>
<% end %><commit_msg>Add extra colours<commit_after><%= form.inputs do %>
  <%= form.input :title %>
  <%= form.input :type, :as => :select, :collection => ['Image', 'Frame', 'Text'] %>

  <div class="types image text hidden">
    <%= form.input :link %>
  </div>

  <div class="types frame <% unless section_module.type == "Frame" %>hidden<% end %>">
    <%= form.input :frame, :collection => {
                                          'Blog'    => 'blog',
                                          'Courses' => 'courses',
                                          'Events'  => 'events',
                                          'News'    => 'news'
                                        } %>
  </div>

  <div class="types image <% unless section_module.type == "Image" %>hidden<% end %>">

    <%= form.inputs "Image file" do %>

      <fieldset class='form-horizontal'>

        <% if section_module.image %>
          <div class='control-group'>
            <%= form.label "Current image", class: 'control-label' %>
            <div class='controls'>
              <%= link_to section_module.image.name, section_module.image.file_url %>
            </div>
          </div>

          <div class='control-group'>
            <%= form.label "Remove image?", class: 'control-label' %>
            <div class='controls'>
              <%= check_box_tag "section_module[remove_image]", "1" %>
            </div>
          </div>

        <% end %>

        <p><%= form.input :image, :as => :file, :label => section_module.image ? "Replace image" : "Upload a new image" %></p>

      </fieldset>

    <% end %>

  </div>

  <div class="types text <% unless section_module.type == "Text" %>hidden<% end %>">
    <%= form.input :text %>
    <%= form.input :colour, :as => :select, :collection =>  {
                                            'Red'                 => 1,
                                            'Orange'              => 2,
                                            'Yellow'              => 3,
                                            'Light Green'         => 4,
                                            'Medium Green'        => 5,
                                            'Turquoise'           => 6,
                                            'Dark Blue'           => 7,
                                            'Medium Blue'         => 8,
                                            'Light Blue'          => 9,
                                            'Pink'                => 10,
                                            'Magenta'             => 11,
                                            'Purple'              => 12,
                                            'Dapaas green'        => 13,
                                            'Dapaas light green'  => 14,
                                            'Dapaas dark green'   => 15,
                                            #'Dapaas black'       => 16,
                                            'Dapaas grey'         => 17,
                                            'Dapaas mid-grey'     => 18
                                          }
    %>
  </div>

  <%= form.submit :value => "Save", :class => "btn btn-success" %>
<% end %>

<%= content_for :extra_javascript do %>
  <script type="text/javascript">
    $("#section_module_type").change(function() {
      $('.types').addClass('hidden');
      $('.' + this.value.toLowerCase()).removeClass('hidden');
    })
  </script>
<% end %>
{'fraction_non_alphanumeric': 0.1502638932008693, 'fraction_numerical': 0.006830176963675877, 'mean_word_length': 1.005915317559153, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 155, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 80, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '962724', 'n_tokens_mistral': 1668, 'n_tokens_neox': 1508, 'n_words': 352}