<commit_before><section>
    <header>
        <h1>#{get_breadcrumbs}</h1>
    </header>

    <div class="tabs">
        <ul>
            <li>
                <a href="#basic" class="icon edit"
                title="#{lang('section_entries.tabs.basic')}">
                    #{lang('section_entries.tabs.basic')}
                </a>
            </li>
            <li>
                <a href="#categories" class="icon categories"
                title="#{lang('section_entries.tabs.categories')}">
                    #{lang('section_entries.tabs.categories')}
                </a>
            </li>

            <?r @custom_fields_hash.each do |id, group| ?>
            <li>
                <a href="#group_#{id}" title="#{group[:name]}">
                  #{group[:name]}
                </a>
            </li>
            <?r end ?>
        </ul>
    </div>

    <div class="body">
        #{form_for(
            @entry,
            :method => :post,
            :action => Sections::Controller::SectionEntries.r(:save),
            :id     => :section_entry_form
        ) do |f|
          f.input_hidden(:csrf_token, get_csrf_token)
          f.input_hidden(:section_id, @section_id)
          f.input_hidden(:id        , @entry.id)

          f.g.div(:id => :basic) do
            f.input_text(
              lang('section_entries.labels.title'),
              :title,
              :required  => :required,
              :maxlength => 255
            )

            f.input_text(
              lang('section_entries.labels.slug'),
              :slug,
              :maxlength => 255
            )

            # Only show the date field when modifying an existing entry
            if !@entry.nil?
              f.input_text(
                lang('section_entries.labels.created_at'),
                :created_at,
                :class => 'date',
                :value => @entry.created_at.strftime('%Y-%m-%d %H:%M:%S')
              )
            end

            f.select(
              lang('section_entries.labels.author'),
              :user_id,
              :values   => ::Users::Model::User.pk_hash(:name),
              :size     => 1,
              :required => :required
            )

            f.select(
              lang('section_entries.labels.status'),
              :section_entry_status_id,
              :values   => ::Sections::Model::SectionEntry.status_hash,
              :selected => @entry.section_entry_status_id,
              :size     => 1
            )
          end

          f.g.div(:id => :categories) do
            if !@possible_categories.empty?
              @possible_categories.each do |group, categories|
                f.input_checkbox(
                  group,
                  :category_pks,
                  @entry.category_pks,
                  :values => categories.invert,
                )
              end
            else
              f.g.p(lang('section_entries.messages.no_categories'))
            end
          end

          # Display all the custom fields for this entry
          @custom_fields_hash.each do |id, group|
            f.g.div(:id => "group_#{id}") do
              group[:fields].each do |field|
                f.send(*field)
              end
            end
          end

          f.g.input(
            :type  => 'submit',
            :value => lang('section_entries.buttons.save'),
            :class => 'button'
          )
        end}
    </div>
</section>
<commit_msg>Use #exists? to check if an object exists.<commit_after><section>
    <header>
        <h1>#{get_breadcrumbs}</h1>
    </header>

    <div class="tabs">
        <ul>
            <li>
                <a href="#basic" class="icon edit"
                title="#{lang('section_entries.tabs.basic')}">
                    #{lang('section_entries.tabs.basic')}
                </a>
            </li>
            <li>
                <a href="#categories" class="icon categories"
                title="#{lang('section_entries.tabs.categories')}">
                    #{lang('section_entries.tabs.categories')}
                </a>
            </li>

            <?r @custom_fields_hash.each do |id, group| ?>
            <li>
                <a href="#group_#{id}" title="#{group[:name]}">
                  #{group[:name]}
                </a>
            </li>
            <?r end ?>
        </ul>
    </div>

    <div class="body">
        #{form_for(
            @entry,
            :method => :post,
            :action => Sections::Controller::SectionEntries.r(:save),
            :id     => :section_entry_form
        ) do |f|
          f.input_hidden(:csrf_token, get_csrf_token)
          f.input_hidden(:section_id, @section_id)
          f.input_hidden(:id        , @entry.id)

          f.g.div(:id => :basic) do
            f.input_text(
              lang('section_entries.labels.title'),
              :title,
              :required  => :required,
              :maxlength => 255
            )

            f.input_text(
              lang('section_entries.labels.slug'),
              :slug,
              :maxlength => 255
            )

            # Only show the date field when modifying an existing entry
            if @entry.exists?
              f.input_text(
                lang('section_entries.labels.created_at'),
                :created_at,
                :class => 'date',
                :value => @entry.created_at.strftime('%Y-%m-%d %H:%M:%S')
              )
            end

            f.select(
              lang('section_entries.labels.author'),
              :user_id,
              :values   => ::Users::Model::User.pk_hash(:name),
              :size     => 1,
              :required => :required
            )

            f.select(
              lang('section_entries.labels.status'),
              :section_entry_status_id,
              :values   => ::Sections::Model::SectionEntry.status_hash,
              :selected => @entry.section_entry_status_id,
              :size     => 1
            )
          end

          f.g.div(:id => :categories) do
            if !@possible_categories.empty?
              @possible_categories.each do |group, categories|
                f.input_checkbox(
                  group,
                  :category_pks,
                  @entry.category_pks,
                  :values => categories.invert,
                )
              end
            else
              f.g.p(lang('section_entries.messages.no_categories'))
            end
          end

          # Display all the custom fields for this entry
          @custom_fields_hash.each do |id, group|
            f.g.div(:id => "group_#{id}") do
              group[:fields].each do |field|
                f.send(*field)
              end
            end
          end

          f.g.input(
            :type  => 'submit',
            :value => lang('section_entries.buttons.save'),
            :class => 'button'
          )
        end}
    </div>
</section>

{'fraction_non_alphanumeric': 0.1312132932244664, 'fraction_numerical': 0.0028649190660363843, 'mean_word_length': 1.207398039835599, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 97, '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': '7252157', 'n_tokens_mistral': 1951, 'n_tokens_neox': 1884, 'n_words': 339}