<commit_before><% can_edit=admin_logged_in? || current_user_is_pal? -%>


<p>
  <span id="model_type_info" style="display:none;"></span>
  <b>Model type:</b><br/>

  <span id="model_type_selection">
    <%= collection_select :model,
      :model_type_id,
      ModelType.find(:all),
      :id,
      :title,
      {:include_blank=>"Not specified"},
      {:onchange=>"model_type_selection_changed();" } -%>
  </span>

  <% if can_edit %>
    <%= link_to_function image("new"), "$('add_model_type_form').show();$('edit_model_type_form').hide();" -%>
    <span id="edit_model_type_icon" style="display:none;">
      <%= link_to_function image("edit"), "$('add_model_type_form').hide();$('edit_model_type_form').show();" -%>
    </span>
    <span id="delete_model_type_icon" style="display:none;">
      <%= hidden_field_tag :selected_model_type_id %>
      <%= link_to_remote image("destroy"),
        :url=>{:action=>:delete_model_metadata,:attribute=>"model_type"},
        :confirm=>"Are you sure you wish to delete this model type?",
        :with=>"$('selected_model_type_id').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('edit_model_type_icon').hide();$('delete_model_type_icon').hide();"
      -%>
    </span>
  
  <% end -%>

</p>

<% if can_edit -%>

  <span id="add_model_type_form" style="display:none;">
    <p>
      <%= text_field_tag :model_type -%>
      <%= button_to_remote "Add",
        :url=>{:action=>:create_model_metadata, :attribute=>"model_type"},
        :with=>"$('model_type').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('add_model_type_form').hide();"
      -%>
    </p>
  </span>

  <span id="edit_model_type_form" style="display:none;">
    <p>
      <%= hidden_field_tag :updated_model_type_id -%>
      <%= text_field_tag :updated_model_type -%>
      <%= button_to_remote "Update",
        {:url=>{:action=>:update_model_metadata, :attribute=>"model_type"},
        :with=>"$('updated_model_type').serialize() + '&' + $('updated_model_type_id').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('edit_model_type_form').hide();"},
        {:id=>"update_model_type_button"}
      -%>
    </p>
  </span>


<% end -%>



<p>
  <span id="model_format_info" style="display:none;"></span>
  <b>Model format:</b><br/>

  <span id="model_format_selection">
    <%= collection_select :model, :model_format_id, ModelFormat.find(:all), :id, :title,
      {:include_blank=>"Not specified"},
      {:onchange=>"model_format_selection_changed();" }
    -%>
  </span>
  <% if can_edit %>
    <%= link_to_function image("new"), "$('add_model_format_form').show();$('edit_model_format_form').hide();" -%>
    <span id="edit_model_format_icon" style="display:none;">
      <%= link_to_function image("edit"), "$('add_model_format_form').hide();$('edit_model_format_form').show();" -%>
    </span>
    <span id="delete_model_format_icon" style="display:none;">
      <%= hidden_field_tag :selected_model_format_id %>
      <%= link_to_remote image("destroy"),
        :url=>{:action=>:delete_model_metadata,:attribute=>"model_format"},
        :confirm=>"Are you sure you wish to delete this model format?",
        :with=>"$('selected_model_format_id').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('edit_model_format_icon').hide();$('delete_model_format_icon').hide();"
      -%>
    </span>

  <% end -%>
</p>

<% if can_edit -%>

  <span id="add_model_format_form" style="display:none;">
    <p>
      <%= text_field_tag :model_format -%>
      <%= button_to_remote "Add",
        :url=>{:action=>:create_model_metadata, :attribute=>"model_format"},
        :with=>"$('model_format').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('add_model_format_form').hide();"
      -%>
    </p>
  </span>

  <span id="edit_model_format_form" style="display:none;">
    <p>
      <%= hidden_field_tag :updated_model_format_id -%>
      <%= text_field_tag :updated_model_format -%>
      <%= button_to_remote "Update",
        {:url=>{:action=>:update_model_metadata, :attribute=>"model_format"},
        :with=>"$('updated_model_format').serialize() + '&' + $('updated_model_format_id').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('edit_model_format_form').hide();"},
        {:id=>"update_model_format_button"}
      -%>
    </p>
  </span>

<% end -%>




<%
environment_options=[['Unknown', 0]]|RecommendedModelEnvironment.find(:all).collect{|e| [h(e.title), e.id]}
%>
<p>
  <b>Preferred execution or visualisation environment:</b>
  <%= select_tag 'model[recommended_environment_id]',
    options_for_select(environment_options, 0),
    {
    :style=>"width:82%",
    :name=>"model[recommended_environment_id]"
  }
%>
</p>

<script type="text/javascript">
<%
ModelFormat.find(:all).each do |format|
  if (format.models.empty?)
    -%>
      model_formats_for_deletion.push(<%=  format.id -%>);
  <%
  end
end

%>

<%
ModelType.find(:all).each do |type|
  if (type.models.empty?)
    -%><commit_msg>execution or visualisation environment is reset to be unknown when editing model<commit_after><% can_edit=admin_logged_in? || current_user_is_pal? -%>


<p>
  <span id="model_type_info" style="display:none;"></span>
  <b>Model type:</b><br/>

  <span id="model_type_selection">
    <%= collection_select :model,
      :model_type_id,
      ModelType.find(:all),
      :id,
      :title,
      {:include_blank=>"Not specified"},
      {:onchange=>"model_type_selection_changed();" } -%>
  </span>

  <% if can_edit %>
    <%= link_to_function image("new"), "$('add_model_type_form').show();$('edit_model_type_form').hide();" -%>
    <span id="edit_model_type_icon" style="display:none;">
      <%= link_to_function image("edit"), "$('add_model_type_form').hide();$('edit_model_type_form').show();" -%>
    </span>
    <span id="delete_model_type_icon" style="display:none;">
      <%= hidden_field_tag :selected_model_type_id %>
      <%= link_to_remote image("destroy"),
        :url=>{:action=>:delete_model_metadata,:attribute=>"model_type"},
        :confirm=>"Are you sure you wish to delete this model type?",
        :with=>"$('selected_model_type_id').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('edit_model_type_icon').hide();$('delete_model_type_icon').hide();"
      -%>
    </span>
  
  <% end -%>

</p>

<% if can_edit -%>

  <span id="add_model_type_form" style="display:none;">
    <p>
      <%= text_field_tag :model_type -%>
      <%= button_to_remote "Add",
        :url=>{:action=>:create_model_metadata, :attribute=>"model_type"},
        :with=>"$('model_type').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('add_model_type_form').hide();"
      -%>
    </p>
  </span>

  <span id="edit_model_type_form" style="display:none;">
    <p>
      <%= hidden_field_tag :updated_model_type_id -%>
      <%= text_field_tag :updated_model_type -%>
      <%= button_to_remote "Update",
        {:url=>{:action=>:update_model_metadata, :attribute=>"model_type"},
        :with=>"$('updated_model_type').serialize() + '&' + $('updated_model_type_id').serialize()",
        :before=>"show_ajax_loader('model_type_selection');$('edit_model_type_form').hide();"},
        {:id=>"update_model_type_button"}
      -%>
    </p>
  </span>


<% end -%>



<p>
  <span id="model_format_info" style="display:none;"></span>
  <b>Model format:</b><br/>

  <span id="model_format_selection">
    <%= collection_select :model, :model_format_id, ModelFormat.find(:all), :id, :title,
      {:include_blank=>"Not specified"},
      {:onchange=>"model_format_selection_changed();" }
    -%>
  </span>
  <% if can_edit %>
    <%= link_to_function image("new"), "$('add_model_format_form').show();$('edit_model_format_form').hide();" -%>
    <span id="edit_model_format_icon" style="display:none;">
      <%= link_to_function image("edit"), "$('add_model_format_form').hide();$('edit_model_format_form').show();" -%>
    </span>
    <span id="delete_model_format_icon" style="display:none;">
      <%= hidden_field_tag :selected_model_format_id %>
      <%= link_to_remote image("destroy"),
        :url=>{:action=>:delete_model_metadata,:attribute=>"model_format"},
        :confirm=>"Are you sure you wish to delete this model format?",
        :with=>"$('selected_model_format_id').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('edit_model_format_icon').hide();$('delete_model_format_icon').hide();"
      -%>
    </span>

  <% end -%>
</p>

<% if can_edit -%>

  <span id="add_model_format_form" style="display:none;">
    <p>
      <%= text_field_tag :model_format -%>
      <%= button_to_remote "Add",
        :url=>{:action=>:create_model_metadata, :attribute=>"model_format"},
        :with=>"$('model_format').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('add_model_format_form').hide();"
      -%>
    </p>
  </span>

  <span id="edit_model_format_form" style="display:none;">
    <p>
      <%= hidden_field_tag :updated_model_format_id -%>
      <%= text_field_tag :updated_model_format -%>
      <%= button_to_remote "Update",
        {:url=>{:action=>:update_model_metadata, :attribute=>"model_format"},
        :with=>"$('updated_model_format').serialize() + '&' + $('updated_model_format_id').serialize()",
        :before=>"show_ajax_loader('model_format_selection');$('edit_model_format_form').hide();"},
        {:id=>"update_model_format_button"}
      -%>
    </p>
  </span>

<% end -%>




<%
environment_options=[['Unknown', 0]]|RecommendedModelEnvironment.find(:all).collect{|e| [h(e.title), e.id]}
%>
<p>
  <b>Preferred execution or visualisation environment:</b>
  <%= select_tag 'model[recommended_environment_id]',
    options_for_select(environment_options, @model.recommended_environment_id),
    {
    :style=>"width:82%",
    :name=>"model[recommended_environment_id]"
  }
%>
</p>

<script type="text/javascript">
<%
ModelFormat.find(:all).each do |format|
  if (format.models.empty?)
    -%>
      model_formats_for_deletion.push(<%=  format.id -%>);
  <%
  end
end

%>

<%
ModelType.find(:all).each do |type|
  if (type.models.empty?)
    -%>
{'fraction_non_alphanumeric': 0.20523804887547464, 'fraction_numerical': 0.0006815305228312725, 'mean_word_length': 4.443561208267091, 'pattern_counts': {'":': 0, '<': 167, '<?xml version=': 0, '>': 247, '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': '920138', 'n_tokens_mistral': 3763, 'n_tokens_neox': 3593, 'n_words': 435}