<commit_before><%= bootstrap_form_tag url: url, method: method, html: { class: 'edit-form' }, data: { 'form-data' => (s3_direct_post.fields), 'url' => s3_direct_post.url, 'host' => URI.parse(s3_direct_post.url).host } do |f| %>
  <%= f.text_field "dataset[name]", label: "Dataset name", value: dataset.name, disabled: !dataset.id.nil?, required: true, placeholder: t(:'dataset.name') %>
  <% if dataset.id.nil? %>
    <%= f.select "dataset[owner]", organization_select_options, { label: t(:'dataset.owner') }, { class: "selectpicker form-control show-tick" } %>
  <% end %>
  <%= f.text_area "dataset[description]", label: "Dataset description", value: dataset.description, placeholder: t(:'dataset.description')  %>
  <%= f.text_field "dataset[publisher_name]", label: "Publisher name", value: dataset.publisher_name, required: true, placeholder: t(:'dataset.publisher_name') %>
  <%= f.url_field "dataset[publisher_url]", label: "Publisher URL", value: dataset.publisher_url, placeholder: t(:'dataset.publisher_url') %>
  <%= f.select "dataset[license]", licenses, label: "License", selected: dataset.license %>
  <%= f.select "dataset[frequency]", Octopub::PUBLICATION_FREQUENCIES, label: "Publication frequency", selected: dataset.frequency %>

  <% if dataset.local_private? %>
    <%= f.form_group :publishing_method, label: { text: "Publish publicly?" } do %>
      <%= f.radio_button :publishing_method, :github_public, label: "Yes, make this data available on the public web", name: "dataset[publishing_method]" %>
      <%= f.radio_button :publishing_method, :local_private, label: "No, keep as private", checked: true, name: "dataset[publishing_method]" %>
    <% end %>
  <% end %>

  <div id="files">
    <% if dataset.dataset_files.count == 0 %>
      <%= render partial: "dataset_files/edit_form", locals: { file: DatasetFile.new, schema: DatasetFileSchema.new, f: f, dataset_file_schemas: dataset_file_schemas } %>
    <% else %>
      <% dataset.dataset_files.order(created_at: :asc).each_with_index do |file, i| %>
        <div class="hidden">
          <%= render partial: "dataset_files/edit_form", locals: { file: DatasetFile.new, schema: DatasetFileSchema.new, f: f, i: i, dataset_file_schemas: dataset_file_schemas } %>
        </div>
        <div class="visible">
        <%= render partial: "dataset_files/edit_form", locals: { file: file, f: f, i: i,   dataset_file_schemas: dataset_file_schemas } %>
        </div>
      <% end %>
    <% end %>
  </div>
  <p class="text-right" id="wut">
    <%= bs_button_to 'Add another data file', '#', style: "success", id: "clone", icon: "glyphicon glyphicon-plus", class: "btn-xs" %>
  </p>

  <% if dataset.id %>
    <div class='panel panel-danger'>
      <div class="panel-heading">
        <h3 class="panel-title">Danger Zone</h3>
      </div>
      <div class="panel-body">
        <%= f.select "dataset[user_id]", options_for_select(user_select_options(@users), dataset.user.id), { label: "Transfer dataset to another user" }, { 'data-live-search': "true", class: "selectpicker form-control show-tick" } %>
        <span id="transferHelpBlock" class="help-block">Selecting another user may make it impossible for you to edit this dataset further. Only change it if you know what you are doing!</span>
      </div>
    </div>
  <% end %>

  <button type="submit" class="btn btn-primary btn-lg btn-block">
    Submit <i class="fa fa-refresh fa-spin hidden" id="spinner"></i>
  </button>
<% end %><commit_msg>Add check for ability to transfer datasets<commit_after><%= bootstrap_form_tag url: url, method: method, html: { class: 'edit-form' }, data: { 'form-data' => (s3_direct_post.fields), 'url' => s3_direct_post.url, 'host' => URI.parse(s3_direct_post.url).host } do |f| %>
  <%= f.text_field "dataset[name]", label: "Dataset name", value: dataset.name, disabled: !dataset.id.nil?, required: true, placeholder: t(:'dataset.name') %>
  <% if dataset.id.nil? %>
    <%= f.select "dataset[owner]", organization_select_options, { label: t(:'dataset.owner') }, { class: "selectpicker form-control show-tick" } %>
  <% end %>
  <%= f.text_area "dataset[description]", label: "Dataset description", value: dataset.description, placeholder: t(:'dataset.description')  %>
  <%= f.text_field "dataset[publisher_name]", label: "Publisher name", value: dataset.publisher_name, required: true, placeholder: t(:'dataset.publisher_name') %>
  <%= f.url_field "dataset[publisher_url]", label: "Publisher URL", value: dataset.publisher_url, placeholder: t(:'dataset.publisher_url') %>
  <%= f.select "dataset[license]", licenses, label: "License", selected: dataset.license %>
  <%= f.select "dataset[frequency]", Octopub::PUBLICATION_FREQUENCIES, label: "Publication frequency", selected: dataset.frequency %>

  <% if dataset.local_private? %>
    <%= f.form_group :publishing_method, label: { text: "Publish publicly?" } do %>
      <%= f.radio_button :publishing_method, :github_public, label: "Yes, make this data available on the public web", name: "dataset[publishing_method]" %>
      <%= f.radio_button :publishing_method, :local_private, label: "No, keep as private", checked: true, name: "dataset[publishing_method]" %>
    <% end %>
  <% end %>

  <div id="files">
    <% if dataset.dataset_files.count == 0 %>
      <%= render partial: "dataset_files/edit_form", locals: { file: DatasetFile.new, schema: DatasetFileSchema.new, f: f, dataset_file_schemas: dataset_file_schemas } %>
    <% else %>
      <% dataset.dataset_files.order(created_at: :asc).each_with_index do |file, i| %>
        <div class="hidden">
          <%= render partial: "dataset_files/edit_form", locals: { file: DatasetFile.new, schema: DatasetFileSchema.new, f: f, i: i, dataset_file_schemas: dataset_file_schemas } %>
        </div>
        <div class="visible">
        <%= render partial: "dataset_files/edit_form", locals: { file: file, f: f, i: i,   dataset_file_schemas: dataset_file_schemas } %>
        </div>
      <% end %>
    <% end %>
  </div>
  <p class="text-right" id="wut">
    <%= bs_button_to 'Add another data file', '#', style: "success", id: "clone", icon: "glyphicon glyphicon-plus", class: "btn-xs" %>
  </p>

  <% if dataset.id && can?(:transfer, dataset) %>
    <div class='panel panel-danger'>
      <div class="panel-heading">
        <h3 class="panel-title">Danger Zone</h3>
      </div>
      <div class="panel-body">
        <%= f.select "dataset[user_id]", options_for_select(user_select_options(@users), dataset.user.id), { label: "Transfer dataset to another user" }, { 'data-live-search': "true", class: "selectpicker form-control show-tick" } %>
        <span id="transferHelpBlock" class="help-block">Selecting another user may make it impossible for you to edit this dataset further. Only change it if you know what you are doing!</span>
      </div>
    </div>
  <% end %>

  <button type="submit" class="btn btn-primary btn-lg btn-block">
    Submit <i class="fa fa-refresh fa-spin hidden" id="spinner"></i>
  </button>
<% end %>
{'fraction_non_alphanumeric': 0.17329910141206675, 'fraction_numerical': 0.0017115960633290544, 'mean_word_length': 4.385560675883257, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 111, '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': '656665', 'n_tokens_mistral': 2370, 'n_tokens_neox': 2210, 'n_words': 556}