<commit_before><%
  addon ||= local_assigns.fetch(:addon, {})
  if @item.respond_to?(:form) && @item.form.present?
    css_class = Array(addon[:class])
    addon[:class] = css_class + %w(hide)
  end
%>

<dl class="see">
  <dd class="wide">
    <%= f.hidden_field "file_ids[]", value: "" %>

    <span class="upload-menu-new">
      <% if @cur_node %>
        <% if @cur_node.becomes_with_route.try(:opendata_sites).present? %>
          <%= link_to t('ss.links.upload'), cms_apis_node_temp_files_path(cid: @cur_node, similar_files: 1, owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
        <% else %>
          <%= link_to t('ss.links.upload'), cms_apis_node_temp_files_path(cid: @cur_node), class: "ajax-box btn" %>
        <% end %>
      <% else %>
        <%= link_to t('ss.links.upload'), cms_apis_temp_files_path, class: "ajax-box btn" %>
      <% end %>
    </span>
    <span class="upload-menu-select">
      <%= link_to t("sns.user_file"), cms_apis_user_files_path(cid: @cur_node || '-', owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
      <%= link_to t("cms.file"), cms_apis_files_path(cid: @cur_node || '-', owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
    </span>
    <div class="upload-drop-area">
      <span class="upload-drop-notice"><%= t('ss.notice.file_droppable') %></span>
    </div>

    <div id="selected-files">
      <% @item.files.each do |file| %>
        <%= render "ss/crud/ajax_files/file_view", file: file %>
      <% end %>
    </div>
  </dd>
</dl>

<%= jquery do %>
  var $el = $("#<%= addon[:id] %>");

  var options = {};
  options.selectUrl = function(id) {
    var selectUrlTemplate = "<%= @cur_node ? select_cms_apis_node_temp_file_path(id: ":id", owner_item_id: @item.id, owner_item_type: @model.to_s) : select_cms_apis_temp_file_path(id: ":id") %>";
    return selectUrlTemplate.replace(":id", id);
  };
  options.uploadUrl = function() {
    var uploadUrlTemplate = "<%= @cur_node ? cms_apis_node_temp_files_path(format: "json", owner_item_id: @item.id, owner_item_type: @model.to_s) : cms_apis_temp_files_path(format: "json") %>";
    return uploadUrlTemplate;
  };
  var tempFile = new SS_Addon_TempFile($el.find(".upload-drop-area"), <%= @cur_user.id %>, options);

  <%
    file_view_options = {
      viewPath: view_cms_apis_content_file_path(id: ":id"),
      confirmationOnDelete: t('ss.confirm.delete'),
      inUseConfirmation: t('ss.confirm.in_use')
    }
  %>
  SS_FileView.renderFileView($el, <%== file_view_options.to_json %>);

  <% if @cur_site.file_resizing.present? %>
    <%
      label = @cur_site.t(:file_resizing_label, size: @cur_site.file_resizing.join("x"))
      value = @cur_site.file_resizing.join(",")
      opts = { label: label, value: value, default: true }
    %>
    SS_AjaxFile.addFileResizing(<%== opts.to_json %>);
  <% end %>
<% end %>
<commit_msg>[fix] unable to edit normal body in preview (#4087)<commit_after><%
  addon ||= local_assigns.fetch(:addon, {})
  if @item.respond_to?(:form) && @item.form.present?
    css_class = Array(addon[:class])
    addon[:class] = css_class + %w(hide)
  end
%>

<dl class="see">
  <dd class="wide">
    <%= f.hidden_field "file_ids[]", value: "" %>

    <span class="upload-menu-new">
      <% if @cur_node %>
        <% if @cur_node.becomes_with_route.try(:opendata_sites).present? %>
          <%= link_to t('ss.links.upload'), cms_apis_node_temp_files_path(cid: @cur_node, similar_files: 1, owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
        <% else %>
          <%= link_to t('ss.links.upload'), cms_apis_node_temp_files_path(cid: @cur_node), class: "ajax-box btn" %>
        <% end %>
      <% else %>
        <%= link_to t('ss.links.upload'), cms_apis_temp_files_path, class: "ajax-box btn" %>
      <% end %>
    </span>
    <span class="upload-menu-select">
      <%= link_to t("sns.user_file"), cms_apis_user_files_path(cid: @cur_node || '-', owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
      <%= link_to t("cms.file"), cms_apis_files_path(cid: @cur_node || '-', owner_item_id: @item.id, owner_item_type: @model.to_s), class: "ajax-box btn" %>
    </span>
    <div class="upload-drop-area">
      <span class="upload-drop-notice"><%= t('ss.notice.file_droppable') %></span>
    </div>

    <div id="selected-files">
      <% @item.files.each do |file| %>
        <%= render "ss/crud/ajax_files/file_view", file: file %>
      <% end %>
    </div>
  </dd>
</dl>

<%= jquery do %>
  var $el = $("#<%= addon[:id] %>");

  var options = {};
  options.selectUrl = function(id) {
    var selectUrlTemplate = "<%= @cur_node ? select_cms_apis_node_temp_file_path(cid: @cur_node, id: ":id", owner_item_id: @item.id, owner_item_type: @model.to_s) : select_cms_apis_temp_file_path(id: ":id") %>";
    return selectUrlTemplate.replace(":id", id);
  };
  options.uploadUrl = function() {
    var uploadUrlTemplate = "<%= @cur_node ? cms_apis_node_temp_files_path(cid: @cur_node, format: "json", owner_item_id: @item.id, owner_item_type: @model.to_s) : cms_apis_temp_files_path(format: "json") %>";
    return uploadUrlTemplate;
  };
  var tempFile = new SS_Addon_TempFile($el.find(".upload-drop-area"), <%= @cur_user.id %>, options);

  <%
    file_view_options = {
      viewPath: view_cms_apis_content_file_path(id: ":id"),
      confirmationOnDelete: t('ss.confirm.delete'),
      inUseConfirmation: t('ss.confirm.in_use')
    }
  %>
  SS_FileView.renderFileView($el, <%== file_view_options.to_json %>);

  <% if @cur_site.file_resizing.present? %>
    <%
      label = @cur_site.t(:file_resizing_label, size: @cur_site.file_resizing.join("x"))
      value = @cur_site.file_resizing.join(",")
      opts = { label: label, value: value, default: true }
    %>
    SS_AjaxFile.addFileResizing(<%== opts.to_json %>);
  <% end %>
<% end %>

{'fraction_non_alphanumeric': 0.1923465947403911, 'fraction_numerical': 0.0010114632501685772, 'mean_word_length': 3.835370823145884, 'pattern_counts': {'":': 8, '<': 89, '<?xml version=': 0, '>': 89, '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': '2551057', 'n_tokens_mistral': 2331, 'n_tokens_neox': 2231, 'n_words': 360}