<commit_before><%= content_tag :div,
  id: "element_#{element.id}",
  data: {'element-id' => element.id, 'element-name' => element.name},
  class: element.css_classes do %>

  <% unless element.fixed? %>
    <%= render 'alchemy/admin/elements/header', element: element %>
  <% end %>

  <% if element.expanded? || element.fixed? %>
    <%= render 'alchemy/admin/elements/toolbar', element: element %>

    <% element.definition[:message].tap do |message| %>
      <%= render_message(:info, sanitize(message)) if message %>
    <% end %>

    <% element.definition[:warning].tap do |warning| %>
      <%= render_message(:warning, sanitize(warning)) if warning %>
    <% end %>

    <% if element.editable? %>
      <%= form_for [alchemy, :admin, element], remote: true,
        html: {id: "element_#{element.id}_form".html_safe, class: 'element-content'} do |f| %>

        <div id="element_<%= element.id %>_errors" class="element_errors"></div>

        <!-- Ingredients -->
        <% if element.has_ingredients_defined? %>
          <div class="element-ingredient-editors">
            <%= render element.ingredients.select { |i| i.definition[:group].blank? }, element_form: f %>

            <!-- Each ingredient group -->
            <% element.ingredients.select { |i| i.definition[:group].present? }.group_by { |i| i.definition[:group] }.each do |group, ingredients| %>
              <div class="content-group">
                <%= link_to '#', id: "content_group_#{group.parameterize.underscore}_header", class: 'content-group-header', data: { toggle_content_group: true } do %>
                  <i class="content-group-expand icon fa-fw fa-plus fas"></i>
                  <%= element.translated_group group %>
                <% end %>
                <%= content_tag :div, id: "element_#{element.id}_content_group_#{group.parameterize.underscore}", class: 'content-group-contents' do %>
                  <%= render ingredients, element_form: f %>
                <% end %>
              </div>
            <% end %>
          </div>
        <% end %>
        <!-- Contents -->
        <div id="element_<%= element.id %>_content" class="element-content-editors">
          <%= render element.contents.select { |c| c.definition[:group].blank? } %>

          <!-- Each content group -->
          <% element.contents.select { |c| c.definition[:group].present? }.group_by { |c| c.definition[:group] }.each do |group, contents| %>
            <div class="content-group">
              <%= link_to '#', id: "content_group_#{group.parameterize.underscore}_header", class: 'content-group-header', data: { toggle_content_group: true } do %>
                <i class="content-group-expand icon fa-fw fa-plus fas"></i>
                <%= element.translated_group group %>
              <% end %>
              <%= content_tag :div, id: "element_#{element.id}_content_group_#{group.parameterize.underscore}", class: 'content-group-contents' do %>
                <%= render contents, element_form: f %>
              <% end %>
            </div>
          <% end %>
        </div>

        <% if element.taggable? %>
          <div class="autocomplete_tag_list">
            <%= f.label :tag_list %>
            <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
          </div>
        <% end %>
      <% end %>

      <%= render 'alchemy/admin/elements/footer', element: element %>
    <% end %>
  <% end %>

  <% if element.nestable_elements.any? %>
    <div class="nestable-elements">
      <%= content_tag :div,
        class: "nested-elements", data: {
          'droppable-elements' => element.nestable_elements.join(' ')
        } do %>
        <%= render element.all_nested_elements.map { |element|
          Alchemy::ElementEditor.new(element)
        } %>
      <% end %>

      <% if element.expanded? || element.fixed? %>
        <% if element.nestable_elements.length == 1 %>
          <% nestable_element = element.nestable_elements.first %>
          <%= form_for [:admin, Alchemy::Element.new(name: nestable_element)],
            remote: true, html: { class: 'add-nested-element-form', id: nil } do |f| %>
            <%= f.hidden_field :name %>
            <%= f.hidden_field :page_version_id, value: element.page_version_id %>
            <%= f.hidden_field :parent_element_id, value: element.id %>
            <button class="button add-nestable-element-button" data-alchemy-button>
              <%= Alchemy.t(:add_nested_element) % { name: Alchemy.t(nestable_element, scope: 'element_names') } %>
            </button>
          <% end %>
        <% else %>
          <%= link_to_dialog Alchemy.t("New Element"),
            alchemy.new_admin_element_path(
              parent_element_id: element.id,
              page_version_id: element.page_version_id
            ), {
              size: "320x125",
              title: Alchemy.t("New Element")
            }, class: "button add-nestable-element-button" %>
        <% end %>
      <% end %>
    </div>
  <% end %>
<% end %>
<commit_msg>Remove unnecesary present? and blank? checks<commit_after><%= content_tag :div,
  id: "element_#{element.id}",
  data: {'element-id' => element.id, 'element-name' => element.name},
  class: element.css_classes do %>

  <% unless element.fixed? %>
    <%= render 'alchemy/admin/elements/header', element: element %>
  <% end %>

  <% if element.expanded? || element.fixed? %>
    <%= render 'alchemy/admin/elements/toolbar', element: element %>

    <% element.definition[:message].tap do |message| %>
      <%= render_message(:info, sanitize(message)) if message %>
    <% end %>

    <% element.definition[:warning].tap do |warning| %>
      <%= render_message(:warning, sanitize(warning)) if warning %>
    <% end %>

    <% if element.editable? %>
      <%= form_for [alchemy, :admin, element], remote: true,
        html: {id: "element_#{element.id}_form".html_safe, class: 'element-content'} do |f| %>

        <div id="element_<%= element.id %>_errors" class="element_errors"></div>

        <!-- Ingredients -->
        <% if element.has_ingredients_defined? %>
          <div class="element-ingredient-editors">
            <%= render element.ingredients.select { |i| !i.definition[:group] }, element_form: f %>

            <!-- Each ingredient group -->
            <% element.ingredients.select { |i| i.definition[:group] }.group_by { |i| i.definition[:group] }.each do |group, ingredients| %>
              <div class="content-group">
                <%= link_to '#', id: "content_group_#{group.parameterize.underscore}_header", class: 'content-group-header', data: { toggle_content_group: true } do %>
                  <i class="content-group-expand icon fa-fw fa-plus fas"></i>
                  <%= element.translated_group group %>
                <% end %>
                <%= content_tag :div, id: "element_#{element.id}_content_group_#{group.parameterize.underscore}", class: 'content-group-contents' do %>
                  <%= render ingredients, element_form: f %>
                <% end %>
              </div>
            <% end %>
          </div>
        <% end %>
        <!-- Contents -->
        <div id="element_<%= element.id %>_content" class="element-content-editors">
          <%= render element.contents.select { |c| !c.definition[:group] } %>

          <!-- Each content group -->
          <% element.contents.select { |c| c.definition[:group] }.group_by { |c| c.definition[:group] }.each do |group, contents| %>
            <div class="content-group">
              <%= link_to '#', id: "content_group_#{group.parameterize.underscore}_header", class: 'content-group-header', data: { toggle_content_group: true } do %>
                <i class="content-group-expand icon fa-fw fa-plus fas"></i>
                <%= element.translated_group group %>
              <% end %>
              <%= content_tag :div, id: "element_#{element.id}_content_group_#{group.parameterize.underscore}", class: 'content-group-contents' do %>
                <%= render contents, element_form: f %>
              <% end %>
            </div>
          <% end %>
        </div>

        <% if element.taggable? %>
          <div class="autocomplete_tag_list">
            <%= f.label :tag_list %>
            <%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f %>
          </div>
        <% end %>
      <% end %>

      <%= render 'alchemy/admin/elements/footer', element: element %>
    <% end %>
  <% end %>

  <% if element.nestable_elements.any? %>
    <div class="nestable-elements">
      <%= content_tag :div,
        class: "nested-elements", data: {
          'droppable-elements' => element.nestable_elements.join(' ')
        } do %>
        <%= render element.all_nested_elements.map { |element|
          Alchemy::ElementEditor.new(element)
        } %>
      <% end %>

      <% if element.expanded? || element.fixed? %>
        <% if element.nestable_elements.length == 1 %>
          <% nestable_element = element.nestable_elements.first %>
          <%= form_for [:admin, Alchemy::Element.new(name: nestable_element)],
            remote: true, html: { class: 'add-nested-element-form', id: nil } do |f| %>
            <%= f.hidden_field :name %>
            <%= f.hidden_field :page_version_id, value: element.page_version_id %>
            <%= f.hidden_field :parent_element_id, value: element.id %>
            <button class="button add-nestable-element-button" data-alchemy-button>
              <%= Alchemy.t(:add_nested_element) % { name: Alchemy.t(nestable_element, scope: 'element_names') } %>
            </button>
          <% end %>
        <% else %>
          <%= link_to_dialog Alchemy.t("New Element"),
            alchemy.new_admin_element_path(
              parent_element_id: element.id,
              page_version_id: element.page_version_id
            ), {
              size: "320x125",
              title: Alchemy.t("New Element")
            }, class: "button add-nestable-element-button" %>
        <% end %>
      <% end %>
    </div>
  <% end %>
<% end %>

{'fraction_non_alphanumeric': 0.1680405204091767, 'fraction_numerical': 0.0013904061972390505, 'mean_word_length': 2.299475753604194, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 183, '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': '2268399', 'n_tokens_mistral': 3289, 'n_tokens_neox': 2920, 'n_words': 567}